• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 17:50
CEST 23:50
KST 06:50
  • 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
Team Liquid Map Contest #22 - The Finalists11[ASL21] Ro16 Preview Pt1: Fresh Flow9[ASL21] Ro24 Preview Pt2: News Flash10[ASL21] Ro24 Preview Pt1: New Chaos0Team Liquid Map Contest #22 - Presented by Monster Energy21
Community News
2026 GSL Season 1 Qualifiers10Maestros of the Game 2 announced32026 GSL Tour plans announced9Weekly Cups (April 6-12): herO doubles, "Villains" prevail0MaNa leaves Team Liquid19
StarCraft 2
General
2026 GSL Tour plans announced Team Liquid Map Contest #22 - The Finalists Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool MaNa leaves Team Liquid Maestros of the Game 2 announced
Tourneys
2026 GSL Season 1 Qualifiers Sparkling Tuna Cup - Weekly Open Tournament Master Swan Open (Global Bronze-Master 2) SEL Doubles (SC Evo Bimonthly) $5,000 WardiTV TLMC tournament - Presented by Monster Energy
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
Mutation # 521 Memorable Boss The PondCast: SC2 News & Results Mutation # 520 Moving Fees Mutation # 519 Inner Power
Brood War
General
Pros React To: Tulbo in Ro.16 Group A Data needed BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion ASL21 General Discussion
Tourneys
[ASL21] Ro16 Group B [Megathread] Daily Proleagues [ASL21] Ro16 Group A [ASL21] Ro24 Group F
Strategy
What's the deal with APM & what's its true value Any training maps people recommend? Fighting Spirit mining rates Muta micro map competition
Other Games
General Games
General RTS Discussion Thread Battle Aces/David Kim RTS Megathread Nintendo Switch Thread Stormgate/Frost Giant Megathread Starcraft Tabletop Miniature Game
Dota 2
The Story of Wings Gaming Official 'what is Dota anymore' discussion
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread Canadian Politics Mega-thread European Politico-economics QA Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Formula 1 Discussion Cricket [SPORT] Tokyo Olympics 2021 Thread
World Cup 2022
Tech Support
[G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Reappraising The Situation T…
TrAiDoS
lurker extra damage testi…
StaticNine
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Iranian anarchists: organize…
XenOsky
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2408 users

The Big Programming Thread - Page 691

Forum Index > General Forum
Post a Reply
Prev 1 689 690 691 692 693 1032 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
Poland17723 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)17733 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.
ils
"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 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 2h 10m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
UpATreeSC 130
ROOTCatZ 45
StarCraft: Brood War
Soma 357
Rush 191
-ZergGirl 46
Dota 2
canceldota56
LuMiX1
Counter-Strike
fl0m5271
Super Smash Bros
hungrybox146
Other Games
summit1g9547
tarik_tv4310
Grubby2863
FrodaN667
C9.Mang0394
KnowMe144
Liquid`Hasu141
ArmadaUGS99
ZombieGrub42
Trikslyr40
ViBE39
KawaiiRice2
Organizations
Counter-Strike
PGL73
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 21 non-featured ]
StarCraft 2
• davetesta50
• Hupsaiya 47
• Sammyuel 43
• Response 2
• IndyKCrew
• sooper7s
• AfreecaTV YouTube
• Migwel
• intothetv
• LaughNgamezSOOP
• Kozan
StarCraft: Brood War
• HerbMon 33
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota21178
League of Legends
• Doublelift2983
• TFBlade1309
Other Games
• imaqtpie949
• Scarra651
• Shiphtur107
Upcoming Events
Replay Cast
2h 10m
The PondCast
12h 10m
WardiTV Map Contest Tou…
13h 10m
CranKy Ducklings
1d 2h
Escore
1d 12h
WardiTV Map Contest Tou…
1d 13h
OSC
1d 17h
Korean StarCraft League
2 days
CranKy Ducklings
2 days
WardiTV Map Contest Tou…
2 days
[ Show More ]
IPSL
2 days
WolFix vs nOmaD
dxtr13 vs Razz
BSL
2 days
Sparkling Tuna Cup
3 days
WardiTV Map Contest Tou…
3 days
Ladder Legends
3 days
BSL
3 days
IPSL
3 days
JDConan vs TBD
Aegong vs rasowy
Replay Cast
4 days
Replay Cast
4 days
Wardi Open
4 days
Afreeca Starleague
4 days
Bisu vs Ample
Jaedong vs Flash
Monday Night Weeklies
4 days
RSL Revival
5 days
Afreeca Starleague
5 days
Barracks vs Leta
Royal vs Light
WardiTV Map Contest Tou…
5 days
RSL Revival
6 days
Liquipedia Results

Completed

Proleague 2026-04-14
RSL Revival: Season 4
NationLESS Cup

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
StarCraft2 Community Team League 2026 Spring
Nations Cup 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026

Upcoming

KCM Race Survival 2026 Season 2
Escore Tournament S2: W3
Escore Tournament S2: W4
Acropolis #4
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
RSL Revival: Season 5
2026 GSL S1
WardiTV TLMC #16
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
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 © 2026 TLnet. All Rights Reserved.