Win a copy of Design for the Mind this week in the Design forum!
    Bookmark Topic Watch Topic
  • New Topic

adding and incrementing data structure elements simultaneously with a faster time possible

 
Moulay Driss
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Report post to moderator
I need to add the new element and increment the other objects of an array of objects (elemt) simultaneously with a faster time.





//----------------



//------- The results:

Time without Incrementation : 15 ms

Time with Incrementation: 156 ms


My objective is to minimize as possible the time of incrementation process

(Time second test < Time first test * 2 )

because actually

Time second test (156 ms) = Time first test (15 ms )* 10

I notes that i can added a new element in any position, but i chose the worst case (adding an element in the first position that requires the incrementation of all **x** element of the arraylist)

I tried many data structure as vector, hashmap ,... but I could not minimize the time of incrementation
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic