pseudocode Questions

16

Solved

For example: int A[] = {3,2,1,2,3,2,1,3,1,2,3}; How to sort this array efficiently? This is for a job interview, I need just a pseudo-code.

2

Solved

I have written the algorithms for recursive and iterative binary search: Recursive AlgorithmBinSrch(a, i,l,x) // Given an array a[i :l] of elementsin nondecreasing // order,1<i <=l,determin...
Ehlers asked 13/8, 2019 at 16:36

7

Solved

How do you write pseudo-code for parallel programming? Especially, how do you differentiate local and shared variables? How do you represent operations like scatter, gather, reduce, broadcast, and ...
Babushka asked 7/4, 2011 at 15:4

3

Solved

I decided to implement a program that can find the GCD of any two numbers (including non-integers) in TI-Basic. I've used this just fine in Java, so I know it works. It works just fine in TI-Basic,...
Gillard asked 24/9, 2012 at 20:35

5

Solved

Abstract Hi, suppose you have two different independent 64-bit binary matrices A and T (T is another matrix that is stored in transposed form, using the transposed version of matrix allows during m...

6

Solved

Jump Game: Given an array, start from the first element and reach the last by jumping. The jump length can be at most the value at the current position in the array. The optimum result is when you ...
Hauteloire asked 28/1, 2012 at 0:25

7

Solved

I need to translate some python and java routines into pseudo code for my master thesis but have trouble coming up with a syntax/style that is: consistent easy to understand not too verbose...
Snip asked 20/2, 2010 at 9:58

1

Solved

How can I check whether 5 given numbers and mathematical operations (+, -, *)could be arranged to get the result of 23? For instance: 1 1 1 1 1 –– Impossible 1 2 3 4 5 –– Possible Specificatio...
Intemperate asked 24/2, 2018 at 20:49

3

I've been trying to figure this out by reverse engineering a .png file I created in GIMP. It's 4x4 pixels. My goal is to decode the raw pixels out of the file with the intent of reversing this to e...
Chivy asked 1/6, 2018 at 7:36

3

Program A() { x, y, z: integer; procedure B() { y: integer; y=0; x=z+1; z=y+2; } procedure C() { z: integer; procedure D() { x: integer; x = z + 1; y = x + 1; call B(); } z =...
Sandal asked 14/3, 2014 at 0:53

1

Solved

Let's say I have the color rgba(255, 0, 0, 0.5) on a white background. The color that can bee seen is almost identical to rgba(255, 140, 140, 1) which is a solid color. I'm looking for an algorithm...
Cystocarp asked 20/1, 2018 at 18:17

1

Solved

I'm trying to implement the alpha beta pruning with transpositional tables, I found the pseudocode of the algorithm in wikipedia: https://en.wikipedia.org/wiki/Negamax#cite_note-Breuker-1 However I...
Warfold asked 1/11, 2017 at 10:24

3

Solved

I've been trying to work out how SHA-256 works. One thing I've been doing for other algorithms is I've worked out a sort of step by step pseudocode function for the algorithm. I've tried to do the ...
Westberry asked 13/8, 2012 at 15:11

2

I'm currently trying to implement a treemap algorithm in Javascript. More specifically the algorithm described in Squarified Treemaps. The pseudo code given looks like the following: procedure squ...
Seddon asked 26/3, 2012 at 22:12

10

How to find out the units digit of a certain number (e.g. 3 power 2011). What logic should I use to find the answer to this problem?
Cartie asked 27/8, 2011 at 12:5

26

Solved

What would be the most optimal algorithm (performance-wise) to calculate the number of divisors of a given number? It'll be great if you could provide pseudocode or a link to some example. EDIT: ...
Varve asked 21/9, 2008 at 5:44

5

// Find a maximum element in the array. findMax(A) findMaxHelper(A, 0, A.length) findMaxHelper(A, left, right) if (left == right - 1) return A[left] else max1 = findMaxHelper(A, left, (right...
Heda asked 29/10, 2012 at 6:58

8

Solved

Say I have nodes connected in the below fashion, how do I arrive at the number of paths that exist between given points, and path details? 1,2 //node 1 and 2 are connected 2,3 2,5 4,2 5,11 11,12 6...
Churning asked 3/4, 2009 at 11:9

4

How can i design an algorithm using BFS or DFS algorithms in order to determine the connected components of a non connected graph, the algorithm must be able to denote the set of vertices of each c...
Finsteraarhorn asked 1/11, 2013 at 22:25

4

Solved

Does anyone know how to do this and what the pseudo code would look like? As we all know a hash table stores key,value pairs and when a key is a called, the function will return the value associat...
Emirate asked 6/11, 2010 at 16:37

1

Solved

Given a set of 2d points (in Cartesian form), I need to find the minimum-area ellipse such that every point in the set lies either on or inside the ellipse. I have found the solution in the form o...
Horribly asked 19/6, 2016 at 19:51

1

In iPython one can write equations using latex syntax which is interpreted by MathJax. But now I want to do also other fancy latex stuff in iPython like writing pseudocode with some latex packages....
Muirhead asked 14/2, 2014 at 15:8

1

Solved

I'm working on a program to solve a variant of the 0/1 Knapsack problem. The original problem is described here: https://en.wikipedia.org/wiki/Knapsack_problem. In case the link goes missing in t...

2

Solved

I have been doing linear programming problems in my class by graphing them but I would like to know how to write a program for a particular problem to solve it for me. If there are too many variabl...

4

I'm trying to come up with something to solve the following: Given a max-heap represented as an array, return the kth largest element without modifying the heap. I was asked to do it in linear t...
Mundy asked 16/7, 2015 at 13:47

© 2022 - 2025 — McMap. All rights reserved.