• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 18:13
CEST 00:13
KST 07:13
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL19] Finals Recap: Standing Tall10HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Weekly Cups (June 30 - July 6): Classic Doubles2[BSL20] Non-Korean Championship 4x BSL + 4x China9Flash Announces Hiatus From ASL66Weekly Cups (June 23-29): Reynor in world title form?14FEL Cracov 2025 (July 27) - $8000 live event22
StarCraft 2
General
The GOAT ranking of GOAT rankings The SCII GOAT: A statistical Evaluation Weekly Cups (June 23-29): Reynor in world title form? Weekly Cups (June 30 - July 6): Classic Doubles Program: SC2 / XSplit / OBS Scene Switcher
Tourneys
RSL: Revival, a new crowdfunded tournament series FEL Cracov 2025 (July 27) - $8000 live event Sparkling Tuna Cup - Weekly Open Tournament WardiTV Mondays Korean Starcraft League Week 77
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 481 Fear and Lava Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ ASL20 Preliminary Maps [ASL19] Finals Recap: Standing Tall SC uni coach streams logging into betting site Flash Announces Hiatus From ASL
Tourneys
[BSL20] Non-Korean Championship 4x BSL + 4x China [BSL20] Grand Finals - Sunday 20:00 CET CSL Xiamen International Invitational The Casual Games of the Week Thread
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Path of Exile What do you want from future RTS games? Beyond All Reason
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread Stop Killing Games - European Citizens Initiative Summer Games Done Quick 2024! Summer Games Done Quick 2025!
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
Formula 1 Discussion 2024 - 2025 Football Thread NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 645 users

The Big Programming Thread - Page 691

Forum Index > General Forum
Post a Reply
Prev 1 689 690 691 692 693 1031 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
hooktits
Profile Blog Joined February 2008
United States972 Posts
December 11 2015 03:11 GMT
#13801
On December 11 2015 11:24 Manit0u wrote:
@hooktits:

First of all, making your admin password more encrypted than regular users won't help that much. Just using password_hash($password, PASSWORD_BCRYPT) should be sufficient in most cases (you can expand it to password_hash($password, PASSWORD_BCRYPT, [ 'cost' => 10 ]) if you think it'll help you much). You generally want all users using the same thing since admin will be saved along them. Where they differ is their permissions.

Website security isn't all about how secure your admin account is. It doesn't mean crap if you have the most secure hashing algorithm and some crazy 128-character length password if someone can go around it by tampering with other parts of your application (giving regular users admin access, breaking into your server and seeing the code etc.). There are pretty crazy things you can do with even pretty basic XSS attacks.

Second of all, unless you absolutely have to write this thing from scratch I'd suggest you don't reinvent the wheel and go with some reliable framework instead. This will give you access to more tools right off the bat and save you a lot of time. Frameworks such as Symfony or Laravel make developing PHP apps pretty enjoyable and you get all the basic security you want with them right off the bat (SQLI, CSRF, admin/user/anonymous user authentication etc. all built-in). On top of that they're built with modern approaches and best practices in mind.

The worst thing you could possibly do here is trying to do it yourself without much experience. You'll end up with a page that's in the 90's or early 2000's security-wise (SQL statements in the views and other bullshit like that). Also, don't ever use WordPress...

Also, try to tackle one thing at a time. Right now it seems like you have a very vague idea on how your project is going to work/look like. One day spent planning can save you a week of work. Focus on that first.




Thanks for for the reply manitou
so i'm gunna touch on your second para started"website security" i totally agree and i and i am skilled in protecting again XSS attacts so that being said i kinda left that out but no worries my bad but i'm aware there is lots more to website security but i didn't wanna list every single thing that can lead to a long debate differeing opinions etc but i was asking if the whole login idea was ok because i don't wanna create a separate login. but again thats hard for your guys to say yes when you know how talented i am at securring a site (good news before the site goes live have a good friend who is a "whitehat" guy and is gunna help me test my site before its released.

in reply to what your said about about building the site from scratch your write i agree and i'm not completely doing that, i'm taking some scripts that have been proven to very secure and made some modifactions but its not ALL from scratch i just said i can code from scratch that sounded stupid when i can use some one elses scripts that have been prooven to be very secure, i'm not some word press y nub, but i agree with you.

in reply to your next statement i am very quite up to date on modern security, probably not as good as you by miles but i'm not as newb as i say i play it up a little the new thing because i know there are so many masters on here.

and as for your final reply i hope i covered everything i want to above i gotta start coding its getting late and i wanna start working on something today to make some progress,(i'm working on a pm msg system tonight) you are right i have a vauge idea and i wish i could have taken alot of time to plan the entire thing out but after i get done working on it and know what i 'm going to require i spend down time planing things but your correct i should have planned it out very well before hand. and again thanks for your reply. advice and kinds words always much appreciated
Hooktits of Tits gaming @hooktits twit
Manit0u
Profile Blog Joined August 2004
Poland17244 Posts
December 11 2015 03:36 GMT
#13802
Well then, back to your original inquiry. Having your regular front-facing pages have special rules for admin user (like allowing you to modify stuff) is a bad idea. If there's even a remote chance that someone can trick your app into showing the admin content to regular users you're screwed. That's why most modern websites have completely separate sections for admin stuff (preferably even without links to it anywhere in the site so those routes don't get mapped by crawlers).
Time is precious. Waste it wisely.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
December 11 2015 04:06 GMT
#13803
On December 11 2015 11:55 Ropid wrote:
Show nested quote +
On December 11 2015 05:32 WarSame wrote:
You're right, I was just curious about it. Why is an ArrayList superior to a LinkedList, though? [...]


This feels like some dirty secret that's not mentioned when learning about data structures.

Here's a video of a presentation about linked lists vs. arrays from the guy that created C++:

+ Show Spoiler +

That's great. Thank you!
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2015-12-12 09:08:49
December 12 2015 06:03 GMT
#13804
On December 11 2015 05:32 WarSame wrote:
Show nested quote +
On December 11 2015 01:10 RoomOfMush wrote:
On December 11 2015 00:54 WarSame wrote:
Random curiosity question - if you have two Java Linked Lists is there a more efficient way to append them together, abusing the fact that they are both Linked Lists? For example, pointing the last element in the 0th list to the 0th element in the 1st list? Note: This is not what .addAll() does.

There is not. But you shouldnt be using LinkedLists anyways. There is very little reason to use them over ArrayLists or ArrayDeques. And even if there is, you wouldnt be needing micro optimizations like this.

You're right, I was just curious about it. Why is an ArrayList superior to a LinkedList, though?

Also, I'd like a bit of help optimizing some code. I'm trying to find the number of unique ways to make change for an int(i.e. 5 nickels and a penny is the same as a penny and 5 nickels, and only count for one way). My method of doing this is a recursive search. I want to use a HashSet for a memo table, but I'm making 4 new CoinCollection(has a number of pennies, nickels, dimes and quarters) each time, with the first taking the input CoinCollection and adding 1 penny, the second adding a nickel, the third a dime, the fourth a quarter. 4 new objects is a lot for a recursive function. However, I don't see how I can check if my current solution is in the HashSet without making these objects. It would save a lot of computation and stack space if I could avoid making them. Does anyone know how to get around making them? Is there something besides a HashSet I can use?

The source code is here. coinCollections is a global variable to avoid having to put it on the stack every call, but if you have a better way of dealing with that please let me know.



Sounds like a job forrrrrr ... dynamic programming!

http://pastebin.com/YPc66gbB

Interview with Google on Wednesday, welp. This was good practice.

edit: mmmm unique ways

http://pastebin.com/7tzkReMA

ahh much faster
There is no one like you in the universe.
Shenghi
Profile Joined August 2010
167 Posts
December 12 2015 12:58 GMT
#13805
On December 12 2015 15:03 Blisse wrote:
Show nested quote +
On December 11 2015 05:32 WarSame wrote:
On December 11 2015 01:10 RoomOfMush wrote:
On December 11 2015 00:54 WarSame wrote:
Random curiosity question - if you have two Java Linked Lists is there a more efficient way to append them together, abusing the fact that they are both Linked Lists? For example, pointing the last element in the 0th list to the 0th element in the 1st list? Note: This is not what .addAll() does.

There is not. But you shouldnt be using LinkedLists anyways. There is very little reason to use them over ArrayLists or ArrayDeques. And even if there is, you wouldnt be needing micro optimizations like this.

You're right, I was just curious about it. Why is an ArrayList superior to a LinkedList, though?

Also, I'd like a bit of help optimizing some code. I'm trying to find the number of unique ways to make change for an int(i.e. 5 nickels and a penny is the same as a penny and 5 nickels, and only count for one way). My method of doing this is a recursive search. I want to use a HashSet for a memo table, but I'm making 4 new CoinCollection(has a number of pennies, nickels, dimes and quarters) each time, with the first taking the input CoinCollection and adding 1 penny, the second adding a nickel, the third a dime, the fourth a quarter. 4 new objects is a lot for a recursive function. However, I don't see how I can check if my current solution is in the HashSet without making these objects. It would save a lot of computation and stack space if I could avoid making them. Does anyone know how to get around making them? Is there something besides a HashSet I can use?

The source code is here. coinCollections is a global variable to avoid having to put it on the stack every call, but if you have a better way of dealing with that please let me know.



Sounds like a job forrrrrr ... dynamic programming!

http://pastebin.com/YPc66gbB

Interview with Google on Wednesday, welp. This was good practice.

edit: mmmm unique ways

http://pastebin.com/7tzkReMA

ahh much faster


Of course, if the question is just the number of ways, it can be much faster: http://ideone.com/pbxKST.

People are not born stupid, they choose to be stupid. If you made that choice, please change your mind.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
December 12 2015 17:04 GMT
#13806
Guess I failed that interview
There is no one like you in the universe.
phar
Profile Joined August 2011
United States1080 Posts
December 12 2015 18:27 GMT
#13807
On December 12 2015 15:03 Blisse wrote:
Show nested quote +
On December 11 2015 05:32 WarSame wrote:
On December 11 2015 01:10 RoomOfMush wrote:
On December 11 2015 00:54 WarSame wrote:
Random curiosity question - if you have two Java Linked Lists is there a more efficient way to append them together, abusing the fact that they are both Linked Lists? For example, pointing the last element in the 0th list to the 0th element in the 1st list? Note: This is not what .addAll() does.

There is not. But you shouldnt be using LinkedLists anyways. There is very little reason to use them over ArrayLists or ArrayDeques. And even if there is, you wouldnt be needing micro optimizations like this.

You're right, I was just curious about it. Why is an ArrayList superior to a LinkedList, though?

Also, I'd like a bit of help optimizing some code. I'm trying to find the number of unique ways to make change for an int(i.e. 5 nickels and a penny is the same as a penny and 5 nickels, and only count for one way). My method of doing this is a recursive search. I want to use a HashSet for a memo table, but I'm making 4 new CoinCollection(has a number of pennies, nickels, dimes and quarters) each time, with the first taking the input CoinCollection and adding 1 penny, the second adding a nickel, the third a dime, the fourth a quarter. 4 new objects is a lot for a recursive function. However, I don't see how I can check if my current solution is in the HashSet without making these objects. It would save a lot of computation and stack space if I could avoid making them. Does anyone know how to get around making them? Is there something besides a HashSet I can use?

The source code is here. coinCollections is a global variable to avoid having to put it on the stack every call, but if you have a better way of dealing with that please let me know.



Sounds like a job forrrrrr ... dynamic programming!

http://pastebin.com/YPc66gbB

Interview with Google on Wednesday, welp. This was good practice.

edit: mmmm unique ways

http://pastebin.com/7tzkReMA

ahh much faster

Good luck.

http://steve-yegge.blogspot.com/2008/03/get-that-job-at-google.html
if you haven't already seen it
Who after all is today speaking about the destruction of the Armenians?
Shenghi
Profile Joined August 2010
167 Posts
December 12 2015 18:31 GMT
#13808
On December 13 2015 02:04 Blisse wrote:
Guess I failed that interview

I don't work at Google and I promise I won't tell anyone. =]

In all seriousness, a good interviewer would nudge you in that direction. There's a big difference between asking for the number of unique ways that change can be made, and asking for all unique ways change can be made.

The question was the number of ways, but the presented recursive solution does output each way.

I'm assuming the real question was indeed the number of ways, as that number would get quite large, quite fast, and there would be too many solutions to generate and output for very small inputs.

You correctly recognized it as a dynamic programming problem, so that's halfway there. It's not a very difficult DP problem either -- it's often used as introduction to dynamic programming. I'm sure you'd have figured it out. =]
People are not born stupid, they choose to be stupid. If you made that choice, please change your mind.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
December 12 2015 18:50 GMT
#13809
On December 13 2015 03:27 phar wrote:
Good luck.

http://steve-yegge.blogspot.com/2008/03/get-that-job-at-google.html
if you haven't already seen it

Everything you "have to know" according to this guy is some low level stuff. What's the point of being able to recite quicksort or implementing a balanced binary tree or what have you? You use an existing implementation whenever you can. In the rare case where you can't, you look it up (in google's case it'd be very surprised if there wasn't a reusable implementation of all these algorithms in the repository already). 5 seconds to pull up the algorithm on wikipedia, a couple of minutes to translate it into your programming language. No bugs because you didn't remember that one step of the algorithm correctly.

It's important to know which algorithms to look up or which general topic to search for the algorithm that could solve your problem. Learning algorithms by heart, however, is a waste of time at best and a source of bugs in the normal case.

But if that's what you need to get hired... not much you can do about it.
If you have a good reason to disagree with the above, please tell me. Thank you.
RoomOfMush
Profile Joined March 2015
1296 Posts
Last Edited: 2015-12-12 19:52:11
December 12 2015 19:51 GMT
#13810
On December 13 2015 03:50 spinesheath wrote:
Show nested quote +
On December 13 2015 03:27 phar wrote:
Good luck.

http://steve-yegge.blogspot.com/2008/03/get-that-job-at-google.html
if you haven't already seen it

Everything you "have to know" according to this guy is some low level stuff. What's the point of being able to recite quicksort or implementing a balanced binary tree or what have you? You use an existing implementation whenever you can. In the rare case where you can't, you look it up (in google's case it'd be very surprised if there wasn't a reusable implementation of all these algorithms in the repository already). 5 seconds to pull up the algorithm on wikipedia, a couple of minutes to translate it into your programming language. No bugs because you didn't remember that one step of the algorithm correctly.

It's important to know which algorithms to look up or which general topic to search for the algorithm that could solve your problem. Learning algorithms by heart, however, is a waste of time at best and a source of bugs in the normal case.

But if that's what you need to get hired... not much you can do about it.

Everything you say is true, but you miss the intend on these interviews. They are not trying to find out if you know your stuff, they try to find the better of 2 people who both know their stuff. If you get enough applicants for the job why not filter a little bit more thoroughly? Wouldnt hurt to separate the wheat from the chaff.
Cyx.
Profile Joined November 2010
Canada806 Posts
December 12 2015 19:59 GMT
#13811
On December 13 2015 03:50 spinesheath wrote:
Show nested quote +
On December 13 2015 03:27 phar wrote:
Good luck.

http://steve-yegge.blogspot.com/2008/03/get-that-job-at-google.html
if you haven't already seen it

Everything you "have to know" according to this guy is some low level stuff. What's the point of being able to recite quicksort or implementing a balanced binary tree or what have you? You use an existing implementation whenever you can. In the rare case where you can't, you look it up (in google's case it'd be very surprised if there wasn't a reusable implementation of all these algorithms in the repository already). 5 seconds to pull up the algorithm on wikipedia, a couple of minutes to translate it into your programming language. No bugs because you didn't remember that one step of the algorithm correctly.

It's important to know which algorithms to look up or which general topic to search for the algorithm that could solve your problem. Learning algorithms by heart, however, is a waste of time at best and a source of bugs in the normal case.

But if that's what you need to get hired... not much you can do about it.

I don't think he ever intended to suggest that those were exactly the topics you need to know to get hired - my interpretation was 'these are good things to study, they probably won't prepare you perfectly but it's better than going in cold.'
Steve Yegge wrote:
I considered giving out a set of tips in which I actually use variable names like X, rather than real subjects, but decided that in the resultant vacuum, everyone would get upset. Otherwise that approach seemed pretty good, as long as I published under a pseudonym.
phar
Profile Joined August 2011
United States1080 Posts
December 12 2015 20:42 GMT
#13812
On December 13 2015 03:50 spinesheath wrote:
Show nested quote +
On December 13 2015 03:27 phar wrote:
Good luck.

http://steve-yegge.blogspot.com/2008/03/get-that-job-at-google.html
if you haven't already seen it

Everything you "have to know" according to this guy is some low level stuff. What's the point of being able to recite quicksort or implementing a balanced binary tree or what have you? You use an existing implementation whenever you can. In the rare case where you can't, you look it up (in google's case it'd be very surprised if there wasn't a reusable implementation of all these algorithms in the repository already). 5 seconds to pull up the algorithm on wikipedia, a couple of minutes to translate it into your programming language. No bugs because you didn't remember that one step of the algorithm correctly.

It's important to know which algorithms to look up or which general topic to search for the algorithm that could solve your problem. Learning algorithms by heart, however, is a waste of time at best and a source of bugs in the normal case.

But if that's what you need to get hired... not much you can do about it.

In a google interview, you are not going to be asked to recite quicksort, or implement a balanced binary tree. The point here is that if you don't already know these basic concepts very well, you're going to have a hell of a hard time answering the actual interview questions. You're not going to be questioned on rote memorization of algorithms or data structures, but you need to be very comfortable with main algorithms & data structures so that you can tackle more interesting questions.
Who after all is today speaking about the destruction of the Armenians?
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
December 12 2015 23:20 GMT
#13813
On December 13 2015 04:51 RoomOfMush wrote:
Show nested quote +
On December 13 2015 03:50 spinesheath wrote:
On December 13 2015 03:27 phar wrote:
Good luck.

http://steve-yegge.blogspot.com/2008/03/get-that-job-at-google.html
if you haven't already seen it

Everything you "have to know" according to this guy is some low level stuff. What's the point of being able to recite quicksort or implementing a balanced binary tree or what have you? You use an existing implementation whenever you can. In the rare case where you can't, you look it up (in google's case it'd be very surprised if there wasn't a reusable implementation of all these algorithms in the repository already). 5 seconds to pull up the algorithm on wikipedia, a couple of minutes to translate it into your programming language. No bugs because you didn't remember that one step of the algorithm correctly.

It's important to know which algorithms to look up or which general topic to search for the algorithm that could solve your problem. Learning algorithms by heart, however, is a waste of time at best and a source of bugs in the normal case.

But if that's what you need to get hired... not much you can do about it.

Everything you say is true, but you miss the intend on these interviews. They are not trying to find out if you know your stuff, they try to find the better of 2 people who both know their stuff. If you get enough applicants for the job why not filter a little bit more thoroughly? Wouldnt hurt to separate the wheat from the chaff.

It hurts if throw away the wheat and keep the chaff. Someone who knows a bunch of algorithms in detail is less useful than someone who can apply a bunch of algorithms to solve problems on a more abstract level.

On December 13 2015 05:42 phar wrote:
Show nested quote +
On December 13 2015 03:50 spinesheath wrote:
On December 13 2015 03:27 phar wrote:
Good luck.

http://steve-yegge.blogspot.com/2008/03/get-that-job-at-google.html
if you haven't already seen it

Everything you "have to know" according to this guy is some low level stuff. What's the point of being able to recite quicksort or implementing a balanced binary tree or what have you? You use an existing implementation whenever you can. In the rare case where you can't, you look it up (in google's case it'd be very surprised if there wasn't a reusable implementation of all these algorithms in the repository already). 5 seconds to pull up the algorithm on wikipedia, a couple of minutes to translate it into your programming language. No bugs because you didn't remember that one step of the algorithm correctly.

It's important to know which algorithms to look up or which general topic to search for the algorithm that could solve your problem. Learning algorithms by heart, however, is a waste of time at best and a source of bugs in the normal case.

But if that's what you need to get hired... not much you can do about it.

In a google interview, you are not going to be asked to recite quicksort, or implement a balanced binary tree. The point here is that if you don't already know these basic concepts very well, you're going to have a hell of a hard time answering the actual interview questions. You're not going to be questioned on rote memorization of algorithms or data structures, but you need to be very comfortable with main algorithms & data structures so that you can tackle more interesting questions.

You need to know what they do and how to use them. That doesn't come across very well in the article. In fact, it's quite the opposite:
Hashtables: hashtables are arguably the single most important data structure known to mankind. You absolutely have to know how they work. Again, it's like one chapter in one data structures book, so just go read about them. You should be able to implement one using only arrays in your favorite language, in about the space of one interview.

He even specifically mentions a very low level detail in "using only arrays". If you need to implement a hashtable, you're likely doing something horribly wrong.

Now, if you're a decent programmer you likely won't have much trouble implementing a basic hash table anyways, but I really don't think that this should be something of relevance in an interview.
If you have a good reason to disagree with the above, please tell me. Thank you.
phar
Profile Joined August 2011
United States1080 Posts
Last Edited: 2015-12-12 23:26:35
December 12 2015 23:25 GMT
#13814
Yes, you should be able to implement a hash table. That doesn't mean you will be asked that in an interview. The questions you will be asked in an interview are typically going to be building on more basic skills.

Just being able to build a hash table out of arrays is not a useful signal for hiring committee.


I'm sorry if Steve's post was not super clear on that point. Also bear in mind it was written like 7 years ago, so some things have changed. Finally, Steve... rambles a bit. For example (another good read, but long and rambly):

https://plus.google.com/ RipRowan/posts/eVeouesvaVX
Who after all is today speaking about the destruction of the Armenians?
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
December 13 2015 02:43 GMT
#13815
Wait, why would you build a hashtable out of arrays? I thought hashtables used linked lists or array lists to deal with collision.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Ilikestarcraft
Profile Blog Joined November 2004
Korea (South)17726 Posts
December 13 2015 04:51 GMT
#13816
You can implement a hashtable as an array of linked lists. Like a key hashes to an index in the array while linked lists are used for collisions to the same index.
"Nana is a goddess. Or at very least, Nana is my goddess." - KazeHydra
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
December 13 2015 05:22 GMT
#13817
Right, I understood that much. However, I never realized legit hashtables are implemented with arrays - what if you have 10 000 elements allocated and only use 5?
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2015-12-13 05:45:19
December 13 2015 05:32 GMT
#13818
What do you mean by 1000 elements allocated and only use 5?

You can build a hash table instead solely with one array - search for hash table with open addressing instead of chaining.

edit: oh you mean about the size of the array. smart hash tables with open addressing resize themselves when they're full like vectors/dynamic arrays do.
There is no one like you in the universe.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
December 13 2015 05:49 GMT
#13819
Right, I get that too. But say you wanted to be able to store 10000 different hash values in the table - do you have to allocate all of them when you first make the table?
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2015-12-13 07:14:29
December 13 2015 06:55 GMT
#13820
Well... yeah? If you have 10K objects to store in the hash table with open addressing then your hash table needs to be able index 10K objects at once with its array. If you pre-allocate the table to size 10K before inserting the elements then it'd be more efficient than letting the table resize itself during the insertions?

Still I have no clue what you mean by allocations. Allocations of what exactly? The object you're storing in the hash table? The hash tables backing array? It sounds like you mean the range of your hash function? You don't need to do that. You only allocate more room/resize when you start getting collisions.
There is no one like you in the universe.
Prev 1 689 690 691 692 693 1031 Next
Please log in or register to reply.
Live Events Refresh
Next event in 1h 47m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 728
ProTech67
ROOTCatZ 56
Livibee 53
JuggernautJason32
UpATreeSC 1
StarCraft: Brood War
Artosis 240
Rock 24
MaD[AoV]14
Stormgate
Nathanias73
Dota 2
NeuroSwarm51
League of Legends
Grubby4548
Counter-Strike
Fnx 2254
taco 746
Stewie2K688
flusha402
sgares146
Super Smash Bros
PPMD146
Mew2King84
Heroes of the Storm
Liquid`Hasu569
Other Games
summit1g7854
tarik_tv2375
fl0m700
mouzStarbuck293
ZombieGrub59
Maynarde17
Organizations
Other Games
gamesdonequick49954
BasetradeTV29
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 22 non-featured ]
StarCraft 2
• kabyraGe 268
• musti20045 36
• davetesta33
• IndyKCrew
• sooper7s
• Migwel
• AfreecaTV YouTube
• LaughNgamezSOOP
• intothetv
• Kozan
StarCraft: Brood War
• 80smullet 31
• Eskiya23 20
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Stormgate
• mYiSmile10
Dota 2
• masondota2985
League of Legends
• Jankos2288
• TFBlade1022
Other Games
• imaqtpie1968
• Shiphtur533
• WagamamaTV222
Upcoming Events
Replay Cast
1h 47m
Sparkling Tuna Cup
11h 47m
WardiTV European League
17h 47m
MaNa vs sebesdes
Mixu vs Fjant
ByuN vs HeRoMaRinE
ShoWTimE vs goblin
Gerald vs Babymarine
Krystianer vs YoungYakov
PiGosaur Monday
1d 1h
The PondCast
1d 11h
WardiTV European League
1d 13h
Jumy vs NightPhoenix
Percival vs Nicoract
ArT vs HiGhDrA
MaxPax vs Harstem
Scarlett vs Shameless
SKillous vs uThermal
uThermal 2v2 Circuit
1d 17h
Replay Cast
2 days
RSL Revival
2 days
ByuN vs SHIN
Clem vs Reynor
Replay Cast
3 days
[ Show More ]
RSL Revival
3 days
Classic vs Cure
FEL
3 days
RSL Revival
4 days
FEL
4 days
FEL
4 days
CSO Cup
4 days
BSL20 Non-Korean Champi…
4 days
Bonyth vs QiaoGege
Dewalt vs Fengzi
Hawk vs Zhanhun
Sziky vs Mihu
Mihu vs QiaoGege
Zhanhun vs Sziky
Fengzi vs Hawk
Sparkling Tuna Cup
5 days
RSL Revival
5 days
FEL
5 days
BSL20 Non-Korean Champi…
5 days
Bonyth vs Dewalt
QiaoGege vs Dewalt
Hawk vs Bonyth
Sziky vs Fengzi
Mihu vs Zhanhun
QiaoGege vs Zhanhun
Fengzi vs Mihu
Liquipedia Results

Completed

BSL Season 20
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Jiahua Invitational
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
CSL Xiamen Invitational
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.