Samual Sam has Published 2492 Articles

C++ Program to Find Deepest Left Leaf in a Binary Tree

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

126 Views

A binary tree which has at most two children, specified as left child and right child. This is a C++ Program to Find Deepest Left Leaf in a Binary TreeAlgorithmBegin.    function deepestLLeafutil() find the deepest left leaf in a given    binary tree:         lvel is level ... Read More

How to generate random values that won’t repeat in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

327 Views

To generate random values that won’t repeat, use HashSet collection. Firstly, create a random object and HashSet −Random randNum = new Random(); Sets = new HashSet();Now, add random integers −while (s.size() < 10) {    s.add(randNum.nextInt()); }Now, display the random numbers that are unique −Listlist = new ArrayList(s); System.out.println(list);Example Live Demoimport ... Read More

JavaTuples addAtX() method for Quartet class

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

74 Views

The addAtX() method is used to add a value to the Quartet Tuple. The index can be set here with the X i.e. the place where the value gets added.Let us first see what we need to work with JavaTuples. To work with Quartet class in JavaTuples, you need to ... Read More

How to setup a Web server like Tomcat to test JSP pages?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

793 Views

Apache Tomcat is an open source software implementation of the JavaServer Pages and Servlet technologies and can act as a standalone server for testing JSP and Servlets, and can be integrated with the Apache Web Server. Here are the steps to set up Tomcat on your machine −Download the latest ... Read More

What is the use of tag in JSP?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

297 Views

The tag allows proper URL request parameter to be specified with URL and also does the necessary URL encoding required.Within a tag, the name attribute indicates the parameter name, and the value attribute indicates the parameter value −AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultnameName of the request ... Read More

LocalDate range() method in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

418 Views

The range of values for a ChronoField can be obtained using the range() method in the LocalDate class in Java. This method requires a single parameter i.e. the ChronoField for which the range of values is required and it returns the range of values.A program that demonstrates this is given ... Read More

How can I generate two separate outputs using Random in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

138 Views

To generate two separate outputs, at first create a new Random object −private static final Random r = new Random();Now, let us declare a value −int val = 5;Loop from the value till 100 and generate random numbers between 1 to 100 −while (val

How do you create a date object from a date in Swift xcode in iOS?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

141 Views

To create a date object in swift we’ll use DateComponents() of swift. We can do this In two ways. We’ll use Playground to test our code instead of simulator.We’ll use date component and calendar to create a date. We can create date component in two ways.Method 1Creating date using the ... Read More

How to convert Wrapper value array list into primitive array in Java?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

495 Views

Here, to convert Wrapper value array list into primitive array, we are considering Integer as Wrapper, whereas double as primitive.At first, declare an Integer array list and add elements to it −ArrayList < Integer > arrList = new ArrayList < Integer > (); arrList.add(5); arrList.add(10); arrList.add(15); arrList.add(20); arrList.add(25); arrList.add(30); arrList.add(45); ... Read More

Search a value in JavaTuples Quartet class

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

72 Views

To search a value in JavaTuples Quartet class, you need to use the contains() method.Let us first see what we need to work with JavaTuples. To work with Quartet class in JavaTuples, you need to import the following package −import org.javatuples.Quartet;Note − Steps to download and run JavaTuples program. If ... Read More

Advertisements