Programming Articles - Page 2615 of 3366

Listing modified, old and newly created files on Linux using C++

George John
Updated on 30-Jul-2019 22:30:26

307 Views

Here we will see how to list the modified files and old and newly created files on Linux platform using C++ program.The task is very simple. We can use the Linux shell command to get the files in desired order. The ls –l command is used to get all of the files in long listing format. Here we will add more options to sort them based on time. (Ascending and Descending). The –t command is used to sort based on time, and –r can be added to reverse the sequence.The command will be like below:ls –lt ls –ltrWe will use ... Read More

Basics of File Handling in C

Chandu yadav
Updated on 18-Nov-2020 05:06:31

1K+ Views

Here we will see some basic file handling operations in C. The operations are listed below:Writing into a FileReading from FileAppending in a FileWrite into a fileSee the code to get the idea how we write into a fileExample Code#include int main() {    FILE *fp;    char *filename = "sample.txt";    char *content = "Hey there! You've successfully created a file with content in c programming language.";    /* open for writing */    fp = fopen(filename, "w");    if( fp == NULL ) {       printf("%s: failed to open. ", filename);       return ... Read More

C++ Program to Check Whether a Directed Graph Contains a Eulerian Path

Ravi Ranjan
Updated on 28-May-2025 12:11:45

552 Views

The Euler path is a path using which we can visit every edge exactly once in a graph. The same vertex can be used for multiple times. The source and destination nodes in the Euler path are different. If the source and destination node become the same, then the Eulerian path is also an Eulerian cycle. In this article, our task is to check if there exists an Eulerian path in the given directed graph. Example of Eulerian Path The figure below displays that an Eulerian path exists in the given directed graph. We can see that the starting ... Read More

C++ Program to Check Whether an Undirected Graph Contains a Eulerian Path

Ravi Ranjan
Updated on 29-May-2025 19:17:56

1K+ Views

The Euler path is a path using which we can visit every edge exactly once in a graph. The same vertex can be used for multiple times. The source and destination nodes in the Euler path are different. If the source and destination node become the same, then the Eulerian path is also an Eulerian cycle. In this article, our task is to check if there exists an Eulerian path in the given undirected graph. Example of Eulerian Path The figure below displays an undirected graph and its respective adjacency matrix. As we can see there exists an Eulerian ... Read More

C++ Program to Check Whether an Undirected Graph Contains a Eulerian Cycle

Ravi Ranjan
Updated on 28-May-2025 17:46:49

563 Views

The Euler path is a path by which we visit every edge exactly once while using the same vertices multiple times. When the starting and ending vertex of the Euler path is the same node (i.e., if a path starts from node 'A' and ends on node 'A'), it is also known as the Eulerian cycle. In this article, our task is to check if the Eulerian cycle exists in the given undirected graph or not. Example of Eulerian Cycle The figure below displays an undirected graph and its respective adjacency matrix. As we can see there exists ... Read More

C++ Program to Perform Sorting Using B-Tree

Chandu yadav
Updated on 30-Jul-2019 22:30:26

446 Views

Here we will see how to get the sorted sequence using B-Tree. The B-tree is n-ary tree. To get the sorted sequences, we can create a B-tree, then add the numbers into it. Here the B-tree can hold maximum 5 nodes. If number of nodes increases, split the node and form new level. As the nodes are holding few number of elements like 5 (at most), we are using Bubble sorting techniques to sort them. as the number of elements is very low, then it will not affect too much on its performance.After traversing the tree, we will get all ... Read More

What is the use of Array.findIndex() method in JavaScript?

Abdul Rawoof
Updated on 25-Aug-2022 12:26:49

477 Views

Array is a data type which can store multiple elements of similar data types. For example, if array is declared as integer data type then it stores one or more elements of the integer data type. In JavaScript, Arrays are objects and these objects have some inbuilt functions and properties by which one can do the operations faster and easier. In this tutorial a functionality of array object ‘findIndex()’ is explained and demonstrated with some examples. The ‘findIndex()’ method in JavaScript arrays will return the first element from the given array with the given constraint being satisfied. This method will ... Read More

What is the use of Array.Find() method in JavaScript?

vineeth.mariserla
Updated on 30-Jul-2019 22:30:26

305 Views

Array.find()Array.find() is used to return value of first element in the array that satisfies provided testing condition(user given condition).If the provided testing condition fails then array.find() returns undefined.In the following example array.find() checks whether the price elements in array are more than the given testing price(12000). If the provided testing condition true then first value that passed the test will be executed, if not undefined will be executed. ExampleLive Demo    var price = [3000, 21000, 28000, 20000, 15500];    function checkCost(cost) {       return cost >= 12000;    }    document.getElementById("price").innerHTML = price.find(checkCost); Output21000

Can we declare an abstract method, private, protected, public or default in java?

Maruthi Krishna
Updated on 29-Jun-2020 13:45:25

12K+ Views

A method which does not have body is known as abstract method. It contains only method signature with a semi colon and, an abstract keyword before it.public abstract myMethod();To use an abstract method, you need to inherit it by extending its class and provide implementation to it.Declaring an abstract method privateIf a method of a class is private, you cannot access it outside the current class, not even from the child classes of it.But, incase of an abstract method, you cannot use it from the same class, you need to override it from subclass and use.Therefore, the abstract method cannot ... Read More

Write a sorting algorithm for a numerical dataset in Python?

AmitDiwan
Updated on 12-Aug-2022 12:07:03

817 Views

Numerical Dataset in Python is for numerical datatypes. Sorting algorithm for integers, includes the following in Python − Bubble sort Shell sort Selection sort Bubble Sort in Python Bubble Sort is comparison-based sorting. The adjacent elements are compared and swapped to make the correct sequence − Example def bubblesort(myList): # Swap the elements to arrange in order for iter_num in range(len(myList)-1, 0, -1): for idx in range(iter_num): if myList[idx]>myList[idx+1]: temp = myList[idx] myList[idx] = myList[idx+1] myList[idx+1] = temp # Unsorted List myList = [40, 23, 7, 49, 32, 98, 76, 48, 87] print("Unsorted List = ", ... Read More

Advertisements