Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by karthikeya Boyini
Page 8 of 143
The Fibonacci sequence in Javascript
The Fibonacci sequence is a series of numbers where each number is the sum of the two preceding ones. The sequence starts with 1, 1 (or sometimes 0, 1). 1, 1, 2, 3, 5, 8, 13, 21, 34, ... Naive Recursive Approach The most straightforward way to generate the nth Fibonacci number uses recursion: function fibNaive(n) { if (n
Read MoreTopological sorting using Javascript DFS
A topological sort or topological ordering of a directed graph is a linear ordering of its vertices such that for every directed edge UV from vertex u to vertex v, u comes before v in the ordering. This only makes sense in directed acyclic graphs (DAGs). There are many places where topological sort makes a lot of sense. For example, let's say you're following a recipe, in this, there are some steps that are prerequisites for going to the next steps. Similarly, during college when selecting courses, there are prerequisites for more advanced courses which themselves may be prerequisites ...
Read MorePrim's algorithm in Javascript
Prim's algorithm is a greedy algorithm that finds a minimum spanning tree for a weighted undirected graph. It finds a subset of the edges that forms a tree that includes every vertex, where the total weight of all the edges in the tree is minimized. The algorithm operates by building this tree one vertex at a time, from an arbitrary starting vertex, at each step adding the cheapest possible connection from the tree to another vertex. How Prim's Algorithm Works Let us look at an illustration of how Prim's algorithm works: 1. Choose any arbitrary node ...
Read MoreComplete Graph Class in Javascript
This article presents a comprehensive Graph class implementation in JavaScript with various graph algorithms including traversal, shortest path, and minimum spanning tree algorithms. Graph Class Structure The Graph class uses an adjacency list representation with two main properties: nodes - Array storing all graph vertices edges - Object mapping each node to its connected neighbors with weights Basic Graph Operations const Queue = require("./Queue"); const Stack = require("./Stack"); const PriorityQueue = require("./PriorityQueue"); class Graph { constructor() { this.edges = {}; ...
Read MoreApple Touch icon for websites in HTML
Apple Touch Icons are custom icons that appear when users add your website to their iPhone or iPad home screen. These icons replace the default website screenshot with a professional-looking app-style icon. Basic Apple Touch Icon To add a basic Apple Touch Icon, include this in your HTML section: This creates a bookmark icon when users tap the share button and select "Add to Home Screen" on iOS devices. Multiple Sizes for Different Devices Different Apple devices require different icon sizes. Use the sizes attribute to specify multiple icons: ...
Read MoreDifference between specification and recommendation that introduced CSS
CSS development follows a formal process where specifications evolve into recommendations through the World Wide Web Consortium (W3C). Understanding this difference helps explain how web standards are created and adopted. What is a CSS Specification? A CSS specification is a working document created by the CSS Working Group that describes new features, properties, or modules for CSS. These are draft documents that undergo continuous review, discussion, and revision. Specifications go through several stages: Working Draft (WD) - Initial public version Candidate Recommendation (CR) - Feature-complete and ready for implementation Proposed Recommendation (PR) - Final review stage ...
Read MoreConverting video to HTML5 ogg / ogv and mpg4
Converting videos to HTML5-compatible formats (OGG/OGV and MP4) ensures cross-browser compatibility for web video playback. HTML5 video elements require specific codecs and containers that not all browsers support uniformly. Why Convert to HTML5 Video Formats? Different browsers support different video formats. To ensure maximum compatibility, you need multiple formats: MP4 (H.264) - Supported by most modern browsers OGG/OGV (Theora) - Open source format, supported by Firefox and older browsers WebM - Google's format, widely supported Using Free HTML5 Video Player And Converter This third-party software simplifies the conversion process with preset configurations optimized ...
Read MoreClass Selectors in CSS
You can define style rules based on the class attribute of the elements. All the elements having that class will be formatted according to the defined rule. Basic Class Selector Syntax Class selectors start with a dot (.) followed by the class name: .black { color: #808000; } This rule renders the content in olive color for every element with class attribute set to "black" in the document. Element-Specific Class Selectors You can make class selectors more specific by combining them with element selectors: h1.black { ...
Read MoreUsage of text-transform property in CSS
The text-transform property in CSS is used to control the capitalization of text content. It allows you to transform text to uppercase, lowercase, capitalize first letters, or leave it unchanged. Syntax text-transform: value; Property Values Value Description none No transformation (default) capitalize Capitalizes the first letter of each word uppercase Converts all text to uppercase lowercase Converts all text to lowercase Example Text Transform Example ...
Read MoreHow to change date time format in HTML5?
HTML5 provides several input types for date and time, but formatting them requires JavaScript. The default browser format can be customized using JavaScript date methods or libraries. HTML5 Date Input Types HTML5 offers various date and time input types: Basic Date Formatting with JavaScript You can format dates using JavaScript's built-in methods: const dateInput = document.getElementById('dateInput'); const output = document.getElementById('output'); dateInput.addEventListener('change', function() { const date = new Date(this.value); ...
Read More