Linear Probing in Hashing [closed] - data-structures

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
A hash table with 10 buckets with one slot per bucket is depicted .The Symbol S1 to S7 are initially entered using a hashing function with linear probing . The maximum no. of comparisons needed in searching an item that is not present??
I am unable to solve this question. Please explain me how it can be computed in simple language for a learner

Consider what happens when all symbols hash to the same number (say zero for simplicity). How many comparisons are required to insert S1, then S2, etc?

Related

I am at a crossroads in my program and I was wondering which path would be more efficient time wise [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I currently see two ways to code the next step of my program and there are probably more, but the two routes I have are as follows.
I take the factors of the lowest number and loop through the other numbers two see if they share those common factors.
I find the factors of the lowest number and add it to a list. I then find the factors of the other numbers that do not exceed the lowest and add them to the same list. I then run through the list to check which is the highest number that appears x times.
I am leaning towards 1, but I'm not sure.
Sorry if this is too ambiguous, thanks.
Well, given the ambiguity, as stated: the 1st requires less steps and avoids the allocation of a data structure.

How do I get a random sample from an array? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
Is there a way to pull a random element from a list? Like say, picking a random name from a list of 10 names.
You can use Array#sample if the list is an array:
names.sample
Otherwise, if it's a string, you can convert it into an array first:
names.split.sample

Concurrent algorithm for strongly connected components (SCCs) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Is anybody aware of a concurrent version of Tarjan's SCCs algorithm, Kosaraju's algorithm or any other fast, O(|V| + |E|) algorithm for finding SCCs? Neither of those algorithms seem to be very hard to multithread, but I'd be happy for somebody else to have done this job.
What I'm trying to handle here is an 8 GB directed graph, which I keep in RAM using a big AWS instance, and I'd like to make a good use of all 16 cores.
That's possibly the best paper I have found so far, I'll have a go at the implementation. http://domino.research.ibm.com/library/cyberdig.nsf/1e4115aea78b6e7c85256b360066f0d4/d8e3597a4172437b8525709f006e42b0?OpenDocument

Discover a priodic pattern in a signal [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Improve this question
I have a large sequence of numbers c.a 10000 and I want to find a priodic pattern in this sequence of numbers. Could you please point me some references or hints to do this job?
First You should determine the length of the periodic pattern. This can be easily made with a Fourier-transformation. Look for frequences with high amplitude. This are candidates for the length of the periodic pattern.
There is a bunch of possible algorithms. Wikipedia lists some here. Although the field is very wide, I hope that will give you a starting point.

Number of times a code is executed [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have a piece of code that says:
for i = 4,16, . . . , n
I am trying to find an upper bound in terms of big oh notation for the number of times the statement gets executed. I believe here it goes like 4,42,43 ... and so on. Since it grows exponentially, it looks like to me that that code is executed about O(logn) times. Am i right? Thanks in advance.
You can confirm your result by thinking in terms of a loop whose index variable is used as the exponent, taking the values 1, 2, 3, ... , floor(log_4(n))

Resources