<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Psingha</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Psingha"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Psingha"/>
	<updated>2026-07-03T11:45:07Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w30_rp&amp;diff=65084</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w30 rp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w30_rp&amp;diff=65084"/>
		<updated>2012-09-15T02:06:26Z</updated>

		<summary type="html">&lt;p&gt;Psingha: Created page with &amp;quot;A Collection is a data structure representing a group of data items sharing common properties (or state) and behaviour. Generally data items represents object of same type and th...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A Collection is a data structure representing a group of data items sharing common properties (or state) and behaviour. Generally data items represents object of same type and their behaviour is governed by the set of operation that can be performed on them. An Array also represents a group of related objects but Array are not considered as collection because an array can only hold a fixed number of items however size of collection is variable, or dynamic. In sum, a collection can be viewed as a single object containing multiple numbers of elements. Few collection types include trees, sets, ArrayList, Dictionary etc.&lt;br /&gt;
&lt;br /&gt;
In order to create, manage and manipulate collection, we have collection framework which depicts representation and manipulation of collection elements independent of their implementation details. It defines application programming interfaces (API’s) consisting of classes and interfaces for manipulating data in collection.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Advantages of collection framework ==&lt;br /&gt;
a)	Performance Improvement: Framework includes highly efficient implementation of data structures and algorithms to manipulate them.&amp;lt;br\&amp;gt;&lt;br /&gt;
b)	Increase in programmer’s productivity: Framework provides ready to use data structures obviating coding of underlying data structure by programmer.&amp;lt;br\&amp;gt;&lt;br /&gt;
c)	Unrelated API interoperability: It provides a common language through which collection can be passed back and forth.&amp;lt;br\&amp;gt;&lt;br /&gt;
d)	Ease in designing, implementing and learning APIs by providing generic collections APIs. &amp;lt;br\&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
== Elements of collection framework ==&lt;br /&gt;
 &lt;br /&gt;
a) Collection Interfaces: These are the basis of the framework and represents different type of collection such as '''List, Set, Queue, and SortedSet.''' &amp;lt;br\&amp;gt;&lt;br /&gt;
b) Implementations: Classes having implementation of Collection interface, partial implementation of a particular interface in order to facilitate custom behaviour like adding constraints on  operations of a particular collection, synchronize data of collection on concurrent use of framework etc.&amp;lt;br\&amp;gt;&lt;br /&gt;
c) Algorithms: These are static methods providing support of useful functions on collection like sorting, searching, checking equality, manipulating elements etc.&amp;lt;br\&amp;gt;&lt;br /&gt;
== Collection Interfaces and Implementations ==&lt;br /&gt;
 &lt;br /&gt;
As mentioned earlier, collection framework has interfaces of collection. In Java programming language, there are two category of interfaces:&amp;lt;br\&amp;gt;&lt;br /&gt;
a) Interfaces extending ‘Collection’ interface: The root interface in the collection framework hierarchy is ‘Interface Collection’ and there are several interfaces which extend this interface like: Set, List, Sorted Set, Queue, Deque etc.&amp;lt;br\&amp;gt;&lt;br /&gt;
b) Interfaces supporting collection-view operations: These interfaces do not extend ‘Collection’ interface however they are used to viewing the group of elements instead of storing a collection. In other terms, we can say that these interfaces represent relation among elements instead of actual collection.&amp;lt;br\&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the following section three major collection interfaces and there implementations are discussed in detail. Different languages provide support for different collections for instance in ruby arrays and hashes are termed as collections while java provide a larger base like maps and lists &lt;br /&gt;
&lt;br /&gt;
'''1.	Set Interface:'''&lt;br /&gt;
It is a collection which extends the Collection interface and contains elements like the sets in mathematics but elements here are distinct, for example, pages of a book. There are several restrictions on the method like add() method cannot add similar objects, moreover equals() can compare 2 set interfaces even if they have separate implementations. However in order to achieve such comparison implementation of interfaces need to override the hashcode() method so that the hashes are well interspersed and minimal collision occurs. It is relevant to note that the value returned by hashcode() is same for 2 sets thus making them equal.&lt;br /&gt;
&lt;br /&gt;
'''Implementations of Set Interface'''&lt;br /&gt;
&lt;br /&gt;
'''a. Hash Set-''' &lt;br /&gt;
It extends set interface and is implemented using a hash table. The result of the Hash Set is not guaranteed to be sorted. The runtime and space complexity of the same is linear and constant. There is an issue with the load factor and the bucket size of the hash set that is if the amount of load factor is very less the hash Set will iterate over the whole bucket unnecessarily.&lt;br /&gt;
&lt;br /&gt;
'''b. Tree Set-'''&lt;br /&gt;
It extends set interface and is implemented using a tree structure. The result of the Tree Set is sorted unlike Hashset. The runtime complexity is logarithmic due to its dynamic nature. The TreeSet resolves the problem of load factor and bucket size as the tree is always balanced. Though TreeSet seems more efficient but HashSet are more in use.&lt;br /&gt;
&lt;br /&gt;
'''c. LinkedHashSet-'''&lt;br /&gt;
It extends the HashSet implementation. The underlying data structure is a doubly link list. It allows viewing the elements in the order they were inserted that is, in an ordered fashion.&lt;br /&gt;
&lt;br /&gt;
'''2.	The List Interface:''' &lt;br /&gt;
It is an ordered collection of elements which extends Collection interface where duplicate elements are allowed to enter. The idea here is to allow iteration over the collection in a position oriented manner. It allows search, add, delete on the collection from the index required. &lt;br /&gt;
&lt;br /&gt;
'''Implementations of List Interface'''&lt;br /&gt;
&lt;br /&gt;
The choice of implementation here depends on the need. &amp;lt;br\&amp;gt;&lt;br /&gt;
'''a. ArrayList-'''&lt;br /&gt;
It implements the List Interface and manages data in the form of a dynamic array. It offers constant time positional access. It works up to the mark, if you wish to randomly access the elements and only manipulate elements at the end. &lt;br /&gt;
&lt;br /&gt;
'''b. LinkedList-'''&lt;br /&gt;
It implements List Interface and manages data in the form of a linkedlist. It should be used if you wish to access elements sequentially and manipulate data from the middle of the list.&lt;br /&gt;
&lt;br /&gt;
'''3. The Map Interface:''' &lt;br /&gt;
The Map interface is different from other interfaces for it doesn’t extend the Collection Interface. It has its own hierarchy. It maintains data in the form of key-value pairs, where key has to be unique, though it does allow null key values. It is also called as associative array. The Map interface implementations also require to override the hashcode()  and equals() method so that equality of 2 maps can be substantiated.&lt;br /&gt;
&lt;br /&gt;
'''Implementations of Map Interface'''&lt;br /&gt;
&lt;br /&gt;
'''a. HashMap-'''&lt;br /&gt;
They are best to use if the problem at hand needs to insert, delete or locate elements in a map. The result of these maps is unsorted. The underlying data structure is a hash table.&lt;br /&gt;
&lt;br /&gt;
'''b. TreeMap-'''&lt;br /&gt;
Theyare best to use if the problem at hand needs to traverse the map in a sorted manner. It is required that a TreeMap implements the comparable interface and overrides the compareTo() method  so that it returns an int stating the status of the compare operation.&lt;br /&gt;
&lt;br /&gt;
== Algorithm in Collection Framework == &lt;br /&gt;
Collection Framework provides support for various algorithms to carry out basic operations with collections. Various collections described above have support for all the basic methods inherited from Collection class which are -add(), addall(), contains(), containsall(), hashcode(). Besides these they provide support for the following algorithms:&lt;br /&gt;
&lt;br /&gt;
'''1. Sort:''' Collection Framework provide support for sorting a List using sort( ) methods in the Collections class. For sorting all items of a collection, its element must be comparable to each other.&amp;lt;br\&amp;gt;&lt;br /&gt;
'''2. Searching:''' Collection Framework provides support for searching a List as well as finding the minimum and maximum values within a Collection. Different ways to search a collection includes searching an unsorted list using contains ( ) method of List collection or searching a sorted list using binarySearch( ) method as that is more fast in comparison to contains( ) method.&amp;lt;br\&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apart from searching a particular element within a List, min( ) and max( ) methods of Collections can be used to find minimum and maximum element in an unsorted collection. Note that if the object in the collection does not implement Comparable then you must provide a Comparator which will serve as comparison operator among the elements of a collection.&amp;lt;br\&amp;gt;&lt;br /&gt;
'''3. Reorganising:'''  Methods like reverse and shuffle alter the index of elements in the collection.&lt;br /&gt;
&lt;br /&gt;
== References: ==&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Collection_(abstract_data_type)#Collection Wikipedia]&amp;lt;br\&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Abstract_data_type #Abstract Data Type Wikipedia]&amp;lt;br\&amp;gt;&lt;br /&gt;
[http://docs.oracle.com/javase/6/docs/api/java/util/Collection.html#Java Collections Oracle]&amp;lt;br\&amp;gt;&lt;br /&gt;
[http://www.digilife.be/quickreferences/PT/Java%20Collections%20Framework.pdf#Java Collection Digilife]&amp;lt;br\&amp;gt;&lt;br /&gt;
[http://www.javapassion.com/javase/javacollections.pdf#Java Collections Java Passion]&lt;/div&gt;</summary>
		<author><name>Psingha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012&amp;diff=65019</id>
		<title>CSC/ECE 517 Fall 2012</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012&amp;diff=65019"/>
		<updated>2012-09-15T01:19:57Z</updated>

		<summary type="html">&lt;p&gt;Psingha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[CSC/ECE 517 Fall 2012/ch1 n xx]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w1 rk]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w20 pp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w5 su]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w6 pp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w4 aj]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w7 am]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w8 aa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w9 av]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w10 pk]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w11 ap]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1a 1w12 mv]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w14 gv]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w17 ir]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w18 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w22 an]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w21 aa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w21 wi]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w31 sa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1a 1w16 br]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1a 1w23 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w24 nr]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w15 rt]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w3 pl]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w32 cm]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w27 ms]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w29 sa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w33 op]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w19 sa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w34 vd]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w35 sa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w30 rp]]&lt;/div&gt;</summary>
		<author><name>Psingha</name></author>
	</entry>
</feed>