Skip to content

drake-mer/java-algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

Java Algorithms

Randomized Queue

A randomized queue is a data structure that allows to push with an O(1) complexity and to pop items randomly chosen, again with an O(1) complexity.

This is of great interest when the order of the items you are working with does not matter.

The dynamic memory allocation choosen ensures that in the average case, the memory consumption is always managed in a secure way without doing much unneeded allocation (basically, it allocates always the same memory amount that was previously occupied when the size of the buffer is exceeded by 1).

Deque (doubly linked list)

This data structure is well known and used to have an O(1) complexity cost at insertion, being at the start or at the end of the list. However, to retrieve the (n-th) element, the complexity is basically in O(n), as for a standard array-stack, the retrieval cost is always O(1) if you know the index of your element.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages