Chunk List

theory question about linked list

Page 1 of 1

1 Replies - 4648 Views - Last Post: 07 May 2009 - 12:08 AM Rate Topic: -----

#1 Meldra  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 23-November 08

Chunk List

Posted 06 May 2009 - 11:19 AM

I was reading about chunk list from Linked List Basics:

Chunk List: Instead of storing a single client element in each node, store a little constant size array of client elements in each node. Tuning the
number of elements per node can provide different performance characteristics: many elements per node has performance more like an
array, few elements per node has performance more like a linked list. The Chunk List is a good way to build a linked list with good performance.

Could someone please show me how this structure looks in C++ or pseudocode?

This post has been edited by Meldra: 06 May 2009 - 11:22 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Chunk List

#2 muballitmitte  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 174
  • View blog
  • Posts: 470
  • Joined: 05-November 08

Re: Chunk List

Posted 07 May 2009 - 12:08 AM

prolly i`m way off but normally for a simple linked list you have smth like this


class Node
{
   info* data;
   Node* next;
  ...
  //look i`m node in the list
}

class List
{
  chief* Node;
  ...
  //the list
}



now this chunk list you speak of should be OK if a priori you select a chunk size and allocate it at ini with further reallocation of sizeof(chunk) so to optimize your program. Now how you program this it`s entirely up to you.

class Node
{
   info* data;
   Node* next;
  ...
  //look i`m node in the list
}

class List
{
  chief** Node;
  ...
  //the list

//whenever you need a new element allocate a chunk-size vector of Node 
}


This post has been edited by muballitmitte: 07 May 2009 - 12:09 AM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1