Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Let Us Imagine Interesting Data Containers

c++ container linked list

  • Please log in to reply
5 replies to this topic

#1 Vampir64

Vampir64

    CC Lurker

  • New Member
  • Pip
  • 6 posts
  • Programming Language:C++, Python, Others

Posted 22 May 2012 - 09:12 AM

[warning: bad english area]
Hi. Almost everyone knows many c++ data containers: simple array, vector, linked list, associative array e.t.c. But can you imagine some useful non-standard (simple or sophisticated) data containers that not exist for now? I can't. It will be great brain training to implement something interesting...
  • 0

#2 brownhead

brownhead

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 167 posts

Posted 22 May 2012 - 12:43 PM

There are tons and tons of weird data structures. Try creating an implementation of a double ended priority queue. I created a Min-Max Heap implementation last year and it was an interesting exercise.
  • 0

#3 Smilex

Smilex

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 76 posts
  • Location:Faroe Islands
  • Programming Language:C, C++, PHP, Python, JavaScript, Lua, Others
  • Learning:Objective-C, PHP, Python, Assembly, Bash

Posted 22 May 2012 - 03:53 PM

Timed data containers. Just something that sprang to mind.
I do not quite see the use for something like that, but the idea would be that everything that is added to the container will be deleted after a specified time.
If the standard has that, then I don't know of it.
  • 0

#4 Vampir64

Vampir64

    CC Lurker

  • New Member
  • Pip
  • 6 posts
  • Programming Language:C++, Python, Others

Posted 23 May 2012 - 08:37 AM

Thank you for some interesting ideas. I also think about implementation of 2d-Sparse array that will be able to do something like this with quite small amount of used memory:

arr a;
a(1,2) = 5;
a(100000,200000) = 6;

  • 0

#5 bbqroast

bbqroast

    Codecall Addict

  • Senior Member
  • PipPipPipPipPipPip
  • 564 posts
  • Location:/etc/passwd

Posted 26 May 2012 - 02:05 PM

What about a kind of hub and spoke array. As in any object can be parented to any other object, it can also carry any type of object. Objects can also just be plain old placeholders. Like:
game>entities>enemies>monster.show()
Where game could be an object with all the game information, entities and enemies are just placeholders and monster is an object.
To clarify game would have nothing to do with (and know nothing about) the entities,enemies and monster spokes. The array simply can has these things referenced under it. Of course the array should have some useful functions (int getCount(game>entities) would return the amount of objects under entities, obj getIndex(game>entities) would get the object under game>entities with the index of 1 (which would be the enemies placeholder), etc).
  • 0
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).

#6 Vampir64

Vampir64

    CC Lurker

  • New Member
  • Pip
  • 6 posts
  • Programming Language:C++, Python, Others

Posted 11 July 2012 - 11:02 PM

Pretty interesting... It's about STL, function pointers etc. Good idea, I need to think.
  • 0





Also tagged with one or more of these keywords: c++, container, linked list

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download