By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,501 Members | 1,678 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,501 IT Pros & Developers. It's quick & easy.

need help on a data structure problem

P: n/a
Not quite related with Python. But my Data Structure course is experiemented
on python and there is no data structure group, So I have to post here:

Write a procedure (in pseudocode!) to increase the number of buckets in a
(closed) hash table. Analyze its time and space complexity.
Feb 2 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Dongsheng Ruan wrote:
Not quite related with Python. But my Data Structure course is experiemented
on python and there is no data structure group, So I have to post here:

Write a procedure (in pseudocode!) to increase the number of buckets in a
(closed) hash table. Analyze its time and space complexity.
What is the question about this problem that you would like to have
answered? Certainly you don't want us to actually give you the answers
to your homework?!?

Here's some Python code to get us started with the discussion:

class HashTable:
def __init__(self):
self.buckets = [ [] ]

@staticmethod
def Hash(object):
return 0

def InsertItem(self, item):
self.buckets[Hash(item)].append(item)

The more I think about it, the more I realize you could probably just
cut'n'paste that code and that should suffice for your answer! Good
luck in Computer Science!
-tom!

--
Feb 2 '07 #2

P: n/a
"Dongsheng Ruan" <ru**@jcmills.comwrites:
Not quite related with Python. But my Data Structure course is
experiemented on python and there is no data structure group, So I
have to post here:
Better, you should discuss it in your class, with your teacher.

--
\ "As we enjoy great advantages from the inventions of others, we |
`\ should be glad to serve others by any invention of ours; and |
_o__) this we should do freely and generously." -- Benjamin Franklin |
Ben Finney

Feb 2 '07 #3

P: n/a
On 2007-02-02, Ben Finney <bi****************@benfinney.id.auwrote:
"Dongsheng Ruan" <ru**@jcmills.comwrites:
>Not quite related with Python. But my Data Structure course is
experiemented on python and there is no data structure group, So I
have to post here:

Better, you should discuss it in your class, with your teacher.
Also: comp.algorithms is the usual Usenet place for discussion of
algorithms and data structures.

However most of the talk there is pretty high-falutin'.

--
Neil Cerutti
It isn't pollution that is hurting the environment; it's the impurities in our
air and water that are doing it. --Dan Quayle
Feb 2 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.