java - Connecting Array Index with Linked List -
i trying implement bucket sort in java without using collections framework, on own. have problem in implementing it.
i wanted store list of elements in particular array index.
for ex:
arr[0]={1,2,3,4}; //here array index 0 storing 4 values.
so chose have linked list store values , map array index linked list.
but not aware of how map array index linked list.
for ex:
arr[0]->linkedlist1 arr[2]->linkedlist2 // ... , on
please suggest how implement it.
in java, arrays or collections collection of objects of same type. so, requirement, need array of lists.
list[] arrayoflists = {};
this creates array each member list (you can create array of linkedlist if like). now, create linkedlist , assign index 0 of array.
linkedlist list1 = new linkedlist(); arrayoflists[0] = list1;
hope helps.
Comments
Post a Comment