Found 26504 Articles for Server Side Programming

How to Check if a Key Exists in the Hashtable in C#?

Shilpa Nadkarni
Updated on 14-Dec-2022 11:47:21

2K+ Views

The Hashtable class in C# represents a collection of key-value pairs. These key-value pairs are organized based on the hash code of the key that is calculated using the hash code function. The key in the hashtable accesses the items. So given a key, we can access the corresponding value for that key in the hashtable. The keys in the hashtable are unique and non-null. The values however can be null or duplicated. We have been discussing hashtable topics in our earlier tutorials. We continue the trend in this article as well. In this article, we will discuss how to ... Read More

Haskell Program to Calculate the Power of a Number

Potti Chandra Sekhar sai
Updated on 14-Dec-2022 11:41:06

1K+ Views

This tutorial discusses writing a program to calculate the power of a number in the Haskell programming language. The nth power of a number is the value when the number is multiplied by itself n times. The power of numbers can be expressed in exponential forms “a^n”, a is raised to the power of n. Here a is called the base and n is called an exponent. For example, 2 raised to the power of 5 is 2^5 i.e 32. In this tutorial, we see different ways to implement a program to calculate the power of a number. Program ... Read More

How to Add Items to Hashtable Collection in C#

Shilpa Nadkarni
Updated on 14-Dec-2022 11:40:06

796 Views

We have already discussed the basics of hashtables. A hashtable collection in C# is used to store key−value pairs wherein each of these key-value pairs is organized based on the hash code of the key. This hash code is calculated using a hash code function. Internally, the hashtable uses buckets to store data. A bucket is nothing but a virtual group of elements within the hashtable. A hash code is associated with each bucket. Programmatically, a hashtable is similar to a dictionary object but unlike in dictionary object, a hashtable can store objects of different data types. Performance−wise, hashtables exhibit ... Read More

Haskell Program to Find the Surface area and Volume of Cuboid

Potti Chandra Sekhar sai
Updated on 14-Dec-2022 11:36:41

285 Views

This tutorial discusses writing a program to find the Surface area and volume of a cuboid in the Haskell programming language. A cuboid is a solid shape that has six rectangular faces. A cuboid has three dimensions length, breadth, and height. The surface area of a cuboid is the total area of the six rectangular faces i.e 2*length*breadth + 2*length*height + 2*breadth*height. The volume of the cuboid is length*breadth*height. As volume is area*height. In this tutorial we see, Program to find the surface area of a cuboid. Program to find the volume of a cuboid. Algorithm Steps ... Read More

Haskell Program to Count Number of Digits in an Integer

Potti Chandra Sekhar sai
Updated on 14-Dec-2022 11:33:52

1K+ Views

In this tutorial, we discuss writing a program to count the number of digits in an integer in the Haskell programming language. In this tutorial, we see three ways to implement a program to count digits in Haskell. Program to count the number of digits in an integer. Program to count the number of digits in an integer using if-else.Program to count the number of digits in an integer using the length function. Algorithmic Steps Take input or initialize a variable for an integer. Implement the program logic to count the digits in an integer. Print or display ... Read More

Haskell Program to Reverse a Number

Potti Chandra Sekhar sai
Updated on 14-Dec-2022 11:30:06

827 Views

This tutorial discusses writing a program to reverse a number in the Haskell programming language. In this tutorial, we see two ways to implement a program in Haskell to reverse a number. Program to reverse a number using the list function reverse. Program to reverse a number using a recursive function. Example 1 Program to reverse a number using the list function reverse. -- function declaration reverseNumber :: Int->Int -- function definition reverseNumber n = k where temp = reverse (show n) ... Read More

Haskell Program to Find the Area of a parallelogram

Potti Chandra Sekhar sai
Updated on 14-Dec-2022 11:22:32

259 Views

This tutorial discusses writing a program to print the area of a parallelogram in the Haskell programming language. A parallelogram is a quadrilateral with opposite sides that have the same size and are parallel to each other. In this tutorial, We see three ways to implement Program to compute the area of a parallelogram using height and base. Program to compute the area of a parallelogram using sides. Program to compute the area of a parallelogram using the diagonals. Algorithm Steps Take input or initialize the variable for the size of the parallelogram. Implement the program ... Read More

Haskell Program to Find the Area of a Rectangle

Potti Chandra Sekhar sai
Updated on 14-Dec-2022 11:16:47

534 Views

This tutorial discusses writing a program to print the area of a rectangle in the Haskell programming language. The rectangle is a quadrilateral with opposite sides having the same length and adjacent sides at right angles. The area of a rectangle is equal to its product of length and breadth. If the length and breadth of the rectangle are 5 and 6 respectively, then the area of that is 30 units(5*6). In this tutorial, We see four ways to implement Program to compute the area of a rectangle using the infix operator “*”. Program to compute the area ... Read More

C++ Program to Sort a Dictionary By Values

Arnab Chakraborty
Updated on 13-Dec-2022 16:51:01

2K+ Views

There are some data structures called dictionaries that are available in various computer languages. A particular form of quicker data structure that stores data based on keys and values is a dictionary. It keeps the key-value pair there so that certain components can be quickly searched by the keys in virtually real-time. The dictionary-like data structure is contained in the C++ STL language standard. This data structure is known by the name "map." The map generates a pair of keys and values of any type (the type must be defined before compilation as we are using C++). In this section, ... Read More

C++ Program to Sort Dictionary by keys

Arnab Chakraborty
Updated on 13-Dec-2022 16:49:21

6K+ Views

In different programming languages, there are some data structures available that are known as dictionaries. The dictionaries are a special kind of faster data structure that stores data based on keys and values. It stores the key-value pair into it so that some elements can easily be searched in almost constant time by the keys. In C++, the dictionary−like data structure is present in C++ STL. The name of this data structure is named as ‘map’. The map creates a pair of keys and values of any type (since we are using C++, the type must be defined before compilation). ... Read More

Advertisements