Posted in C#, Data Structure, Uncategorized

Data Structures comparison in C#

Data StructureDescriptionKey FeaturesUse CasesPerformance
ArrayFixed-size, contiguous memory allocation. Used for storing elements of the same type.– Constant-time access (O(1)) for indexed elements.- Cannot resize once created.– Low-level data storage.- Known fixed size.Access: O(1)- Search: O(n)- Insertion/Deletion: Not supported efficiently
List (List<T>)A dynamic array that resizes automatically when elements are added/removed.– Dynamically resizable.- Maintains order of elements.- Supports LINQ queries.– Storing ordered data.- Frequent additions/removals.Access: O(1)- Search: O(n)- Insertion/Deletion: O(n) (due to resizing or shifting elements)
Dictionary (HashMap)A collection of key-value pairs implemented as a hash table.– Fast lookups with unique keys.- Unordered.- Keys must be unique.– Storing mappings (e.g., ID → Object).Access/Search: O(1) (average)- Insertion/Deletion: O(1) (average)
HashSetA collection of unique elements, implemented as a hash table.– Fast lookups.- Only stores unique elements.- Unordered.– Checking membership.- Removing duplicates.Add/Search: O(1) (average)- Insertion/Deletion: O(1)
QueueA FIFO (First-In-First-Out) collection.– Enqueue (add to end).- Dequeue (remove from front).- Used for sequential processing.– Task scheduling.- Order-sensitive tasks.Enqueue/Dequeue: O(1)
StackA LIFO (Last-In-First-Out) collection.– Push (add to top).- Pop (remove from top).- Peek (view top element).– Undo operations.- Depth-first search.Push/Pop: O(1)
SortedListA sorted collection of key-value pairs (sorted by key).– Maintains keys in sorted order.- Slower than Dictionary for large datasets.– When sorted keys are important.Search: O(log n)- Insertion/Deletion: O(n)
LinkedListA doubly linked list where each element points to the next and previous elements.– Efficient insertion/deletion at any position.- No random access (sequential only).– Frequent insertions/deletions.- Traversing data.Access/Search: O(n)- Insertion/Deletion: O(1) (if the node reference is known)
Posted in App-server, Java EE, Tomcat, Uncategorized, Web-Server

Application Server vs. Web Server

This chart* perfectly captures different features of App Servers versus Web Servers:

Application Server Web Server
What is it? A server that exposes business logic to client applications through various protocols including HTTP. A server that handles HTTP protocol.
Job Application server is used to serve web based applications and enterprise based applications(i.e servlets, jsps and ejbs…). Application servers may contain a web server internally. Web server is used to serve web based applications.(i.e servlets and jsps)
Functions To deliver various applications to another device, it allows everyone in the network to run software off of the same machine. Keeping HTML, PHP, ASP, etc files available for the web browsers to view when a user accesses the site on the web, handles HTTP requests from clients.
Supports distributed transaction and EJB’s Servlets and JSP
Resource utilization High Low

Question: Apache Tomcat is a Web Server or an Application Server?

Answer: Tomcat is a web server (can handle HTTP requests/responses) and web container (implements Java Servlet API, also called servletcontainer) in one. Some may call it an application server, but it is definitely not an fullfledged Java EE application server (it does not implement the whole Java EE API).**

————————————————————————–

* source: http://www.diffen.com/difference/Application_Server_vs_Web_Server

**http://stackoverflow.com/questions/2469949/tomcat-is-web-server-or-application-server