datastructures

DSA: Trie – interview preparation questions

DSA: Trie – interview preparation questions

 1. Trie Basics and Operations·      Implement a Trie (Insert, Search, Delete)·      Implement a TrieNode Class·      Insert a Word into a Trie·      Search for a Word in a Trie·      Delete a Word from a Trie·      Check if a Prefix Exists in a Trie·      Count Words in a Trie·      Count Prefixes in a Trie·      Implement a Trie with Case Sensitivity·      Implement a Trie with Case Insensitivity  2. Trie-Based String Operations·      Find All Words with a Given Prefix (Using Trie)·      Find Words that Start with a Given Prefix (Using Trie)·      Find All Words that End with a Given Suffix (Using Trie)·      Find Longest Prefix…
Read More
Doubly Linked List Implementation in Go

Doubly Linked List Implementation in Go

Hi there DEV.to community! As a second part of my previous post (linked in the series above), here we will implement a doubly linked list. A doubly linked list is just as a singly linked list with one difference. Each node refers to both its next node and its previous node. Thus we may move forward in the list using a function called GetNext and move to the previous node with a function called GetPrev. Image source: GeeksforGeeks Before we start here is the structure I'd like to organize my codes like: project ├── doubly_linked_list │ ├── node.go │ └──…
Read More
Singly Linked List Implementation in Go

Singly Linked List Implementation in Go

Hey there DEV.to community! This is a part of my data structures and algorithms series. In this article, we will implement a singly linked list then in the next articles from this series I will implement other kinds of linked lists as well using Go. Image source: GeeksforGeeks To implement a singly linked list we need to structures, a node and a singly linked list itself. But before beginning to code here is how I like to organize my code: project ├── singly_linked_list │ ├── node.go │ └── list.go └── main.go Enter fullscreen mode Exit fullscreen mode A node only…
Read More
Managing Streaming Data with Min and Max Heaps in JavaScript: A Digital Athlete Health Tech Perspective

Managing Streaming Data with Min and Max Heaps in JavaScript: A Digital Athlete Health Tech Perspective

Data management is crucial in health tech. Whether tracking performance metrics or monitoring recovery times for athletes, organizing data efficiently can make a significant difference in how insights are derived. One powerful tool for managing data in such scenarios is the heap, specifically min and max heaps. In this post, we'll explore how to implement and use min and max heaps in JavaScript, using real-world examples related to athlete data management. What are Heaps? A heap is a specialized binary tree-based data structure that satisfies the heap property. In a min heap, the parent node is always smaller than or…
Read More
Union-Find, Data Structures

Union-Find, Data Structures

Union-Find Data Structure class UnionFind { private: vector<int> parent; vector<int> rank; public: // Constructor to initialize Union-Find with n elements UnionFind(int n) { parent.resize(n); rank.resize(n, 0); for (int i = 0; i < n; ++i) { parent[i] = i; // Each element is its own parent initially } } // Find the representative or root of the set containing 'vertex' int find(int vertex) { if (parent[vertex] != vertex) { parent[vertex] = find(parent[vertex]); // Path compression } return parent[vertex]; } // Union the sets containing 'u' and 'v' void unite(int u, int v) { int rootU = find(u); int rootV =…
Read More
CRISP-DM: The Essential Methodology for Structuring Your Data Science Projects

CRISP-DM: The Essential Methodology for Structuring Your Data Science Projects

As with any IT project, Machine Learning projects need a framework. However, classical methodologies do not apply or apply very poorly to Data Science. Among the existing methodologies, CRISP-DM is the most commonly used and will be presented here. Several variants exist. Be careful, CRISP is a framework and not a rigid structure. The purpose of using a methodology is not to have a magic formula or to be limited. It mainly provides an idea of the progress and steps, as well as good practices to follow. CRISP-DM stands for "Cross Industry Standard Process for Data Mining." It is, therefore,…
Read More
Tree data structures in Rust with tree-ds (#1: Getting Started)

Tree data structures in Rust with tree-ds (#1: Getting Started)

Trees are a fundamental data structure used across various applications. In Rust, building your own tree from scratch can be a great learning experience, but for production use, consider leveraging existing crates. In this three part series, we'll explore the tree-ds crate, a powerful tool for working with trees in your Rust projects. Introducing tree-ds The tree-ds crate, provides a versatile tree implementation in Rust. It offers a generic Tree struct that can hold any data type as its node value. The crate also supports various tree operations, making it a comprehensive solution for your tree-based needs. Getting Started To…
Read More
Stacks, Data Structures

Stacks, Data Structures

Stacks A stack is a fundamental data structure in computer science that operates on a Last In, First Out (LIFO) principle. This means that the last element added to the stack is the first one to be removed. Stacks are analogous to a pile of plates where you can only add or remove the top plate. This simplicity and the constraint on how elements are added and removed make stacks particularly useful for certain types of problems and algorithms. Basic Concepts of Stacks Push Operation: This operation adds an element to the top of the stack. If the stack is…
Read More
Linked List, Data Structures

Linked List, Data Structures

Linked List A linked list is a fundamental data structure used in computer science to organize and store data efficiently. Unlike arrays, linked lists consist of nodes, where each node contains data and a reference (or link) to the next node in the sequence. This structure allows for dynamic memory allocation and efficient insertions and deletions, making linked lists highly versatile and useful for various applications. Comparison with Arrays Linked lists and arrays are both used to store collections of elements, but they have key differences that affect their performance and usage: Memory Allocation: Arrays: Use contiguous memory allocation. The…
Read More
No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.