• What do you need help with? Version 1
    5,001 replies, posted
A list can add and remove elements at any point quite efficiently. However, random access is slower. Linked lists can be either singly linked, which makes iteration in one direction efficient, or doubly linked, which makes iteration in both directions efficient, at the cost of a little bit more memory per element. Usually lists keep a pointer to the beginning and the end of the list, though it is not mandatory to have both.
Well, you have queues, you have stacks. I don't see why a list that can do what both of those can would be more efficient at doing only one of those things.
[QUOTE=Darwin226;24343858]Well, you have queues, you have stacks. I don't see why a list that can do what both of those can would be more efficient at doing only one of those things.[/QUOTE] Stacks and queues are often implemented using lists.
[QUOTE=Darwin226;24343858]Well, you have queues, you have stacks. I don't see why a list that can do what both of those can would be more efficient at doing only one of those things.[/QUOTE] I didn't say lists are more efficient than queues or stacks. Lists have the major disadvantage of slow random access. If you don't need random access or having the elements stored sequentially (like in a vector or a traditional array) lists are quite probably the way to go though. [QUOTE=gparent;24343893]Stacks and queues are often implemented using lists.[/QUOTE] I read that queues usually use deques, which are though also sometimes implemented as linked lists. It's also common to implement them like this though: [img_thumb]http://pages.cpsc.ucalgary.ca/~kremer/STL/1024x768/deque.jpeg[/img_thumb]
Hmmm, I thought stacks and queues didn't even have random access.
[QUOTE=Darwin226;24344248]Hmmm, I thought stacks and queues didn't even have random access.[/QUOTE] They don't really. You can get to the middle elements by traversing the whole linked list. There's also skip lists (linked lists with extra links that skip several elements) which are O(log n) instead of O(n) for random access. [editline]09:06PM[/editline] Whoops. You guys were talking about one thing, I went off on a complete and total tangent. Disregard this post.
So, the disadvantage of using a list is slow random access, something which queues and stacks don't even have. What's the purpose of using them then except for maybe making the code a bit easier to read since the method names are different and you kind of know what they are usually used for.
[QUOTE=Darwin226;24345830]So, the disadvantage of using a list is slow random access, something which queues and stacks don't even have. What's the purpose of using them then except for maybe making the code a bit easier to read since the method names are different and you kind of know what they are usually used for.[/QUOTE] Stacks and queues just enforce your code contract. You could use a dynamic array too if you wanted, what's your point?
Nothing else but this. And possibly the knowledge that noone can fuck around with it and has to use them like a queue or stack. btw in C++ the standard library queue and stack can be given a parameter to decide which container it shall internally use; both use a deque by default.
[QUOTE=Darwin226;24345830]So, the disadvantage of using a list is slow random access, something which queues and stacks don't even have. What's the purpose of using them then except for maybe making the code a bit easier to read since the method names are different and you kind of know what they are usually used for.[/QUOTE] A queue/stack is more abstract than a linked list. A linked list is just one means of implementing a queue/stack.
Yeah I have a question, is there a way to get past Open DNS so i can access facebook and bypass anyblocked sites?
[QUOTE=~Kiwi~;24346431]Yeah I have a question, is there a way to get past Open DNS so i can access facebook and bypass anyblocked sites?[/QUOTE] Wrong section. Try changing your DNS server.
[QUOTE=ROBO_DONUT;24346461][B]Wrong section.[/B] Try changing your DNS server.[/QUOTE] yeah thanks just the title said "[URL="http://www.facepunch.com/showthread.php?p=24346461#post24346461"][What do you need help with? Version 1[/URL] " How would I change the DNS server in a HIgh school
Wrong section as in not programming-related. And this thread is in the programming-section ;)
[QUOTE=~Kiwi~;24346431]Yeah I have a question, is there a way to get past Open DNS so i can access facebook and bypass anyblocked sites?[/QUOTE] DNS filtering is trivial to bypass. If you can't figure it out by yourself, you don't deserve to know.
[QUOTE=turb_;24346555]DNS filtering is trivial to bypass. If you can't figure it out by yourself, you don't deserve to know.[/QUOTE] Hey some of us have important stuff to do, like job hunting and facebooking.
[QUOTE=~Kiwi~;24346516]yeah thanks just the title said "[URL="http://www.facepunch.com/showthread.php?p=24346461#post24346461"][What do you need help with? Version 1[/URL] " How would I change the DNS server in a HIgh school[/QUOTE] If it's not your machine, don't.
[QUOTE=~Kiwi~;24346516]yeah thanks just the title said "[URL="http://www.facepunch.com/showthread.php?p=24346461#post24346461"][What do you need help with? Version 1[/URL] " How would I change the DNS server in a HIgh school[/QUOTE] Asking for help about DNS in a thread called "What do you need help with?" in the Furry forum wouldn't be welcome either, FYI.
[QUOTE=ZeekyHBomb;24346534]Wrong section as in not programming-related. And this thread is in the programming-section ;)[/QUOTE] Yeah it popped up as the latest post on the home page so I was assuming it was in Just Hardware and Software not Programming.
[QUOTE=~Kiwi~;24346580]Hey some of us have important stuff to do, like job hunting and facebooking.[/QUOTE] I've heard that excuse :rolleyes:
[QUOTE=ROBO_DONUT;24346602]I've heard that excuse :rolleyes:[/QUOTE] :D?
[QUOTE=~Kiwi~;24346516]How would I change the DNS server in a HIgh school[/QUOTE] If we do that we'd get backtraced and arrested by the cyber-police. Consequences will never be the same :ohdear: inb4 GUI in Visual Basic to track down the killers IP
[QUOTE=ZeekyHBomb;24346716]If we do that we'd get backtraced and arrested by the cyber-police. Consequences will never be the same :ohdear: inb4 GUI in Visual Basic to track down the killers IP[/QUOTE] BAH, oh well, worth a try.
I just want to first point out that I have next-to-none experience in C++, but just want a simple way to create a flashlight weapon for a Source Mod that turns the flashlight on and off. I just want it to be a separate like a pistol, and when you click it turns the flashlight on and off. That's all I really want from it. Any help would be appreciated.
[QUOTE=Zally13;24347503]I just want to first point out that I have next-to-none experience in C++, but just want a simple way to create a flashlight weapon for a Source Mod that turns the flashlight on and off. I just want it to be a separate like a pistol, and when you click it turns the flashlight on and off. That's all I really want from it. Any help would be appreciated.[/QUOTE] Source is not a good platform for learning for someone with next-to-none experience in C++. Although the title could possibly be misleading, this thread is for helping you program, not helping by making you programs you don't even understand (which doesn't actually help you with your programming at all). Sorry if I come off as rude, but the sooner you realize this, the closer you get to actually getting what you want.
[QUOTE=Darwin226;24343402]Well, if A* is anything like breadth first search, and I'm pretty sure it is, then no. A queue adds elements to the front and removes them from the back, hence the name. I think the list adds to the front and can remove any element. As I said, haven't looked at the code but I think the idea is to start at the first field, mark every field around it with 1, then every field around those with 2 and so on until you reach the end field. Then back track from to get the path. You push the first field in the queue and then, with a while (queue.Count > 0) { currentField = queue.Dequeue() } add the 4 (or 8 if you go diagonally too) surrounding fields to the queue and so on. If you for example used a stack, it would first go trough one possible path, then the next one and so on, when the queue goes trough all of them at the same time, step by step.[/QUOTE] Still A* works a bit different I don't see how a queue could speed it up... you still need to search the queue for the node with the lowest score and still need to see if you already visited a node.
Apparently it couldn't. It's just easier to use since you have Enqueue and Dequeue methods.
Yea well going to implement my own sorted stack :) its working now, I forgot that the first tile of the map is 0,0 and not 1,1 -__- thanks anyway
[QUOTE=jA_cOp;24348048]Source is not a good platform for learning for someone with next-to-none experience in C++. Although the title could possibly be misleading, this thread is for helping you program, not helping by making you programs you don't even understand (which doesn't actually help you with your programming at all). Sorry if I come off as rude, but the sooner you realize this, the closer you get to actually getting what you want.[/QUOTE] Alright, I understand.
Fixed :) -snip-
Sorry, you need to Log In to post a reply to this thread.