Skip to main content

Posts

Showing posts from December, 2019

Launch of 5G chipsets by Qualcomm for AR/VR Headsets

Virtual reality (VR) and augmented reality (AR) is all set to transform the way users used to access technology. The headsets can take you to places and show things that don't even exist in the real world. Qualcomm's all-new AR/VR tech brings 5G support and caters to the needs of standalone VR, AR headsets.
Qualcomm claims that the XR2 chip is in line with the company's new mobile chips, including the most awaited Snapdragon 865, 765, and 765G. These chipsets support 5G mobile network connectivity. Qualcomm believes that the future of mobile devices is an aggregate of different display technologies. The VR headsets can be used for various uses cases, right from web browsing, to recipe tutorials and even GPS navigation.
In an official statement, Qualcomm said, "Multiple OEMs are committed to commercializing devices with the Snapdragon XR2 Platform, and other customers are in various stages of prototyping and evaluation."
The XR2 5G platform is designed to support 3K …

C++ program to convert Sorted Array to binary search tree

Binary Search Tree is a node-based binary tree data structure which has the following properties: The left subtree of a node contains only nodes with keys lesser than the node%u2019s key.The right subtree of a node contains only nodes with keys greater than the node%u2019s key.The left and right subtree each must also be a binary search tree.Algorithm The mid-value of the given sorted array would represent the root of one possible BST that can be constructed from the given array elements. 1. Find the middle element of the array and make it root(Now the array is divided into two halves left and right, where the left half is our left subtree and right half, is our right subtree) 2. Recursively do the same for the left half and right half.        (a) Get the middle of left half and make it left child of the root created into Step 1.        (b) Get the middle of right half and make it right child of the root created into Step 1. 3. The base condition that would terminate the recursion would then…

Dynamic Programming - Rod Cutting Problem

This is one of the famous interview questions and most of you faced this question in the interview.
Question: Given a rod of length n and list of prices of rod of length i where 1 <= i <= n, find the optimal way to cut rod into smaller rods in order to maximize profit. Program: #include<iostream>#include<algorithm>usingnamespace std; #define ROD_CUTS 4#define LEN 5int rodSize[ROD_CUTS] = {1, 2, 3, 4}; int rodSizeCost[ROD_CUTS] = {2, 5, 7, 8}; int costMatrix[ROD_CUTS][LEN+1] = {0}; intfindCost(int i, int j) { if(i < 1) return costMatrix[i][j-rodSize[i]]+rodSizeCost[i]; else { if(j < rodSize[i]) return costMatrix[i-1][j]; elsereturn std::max(costMatrix[i][j-rodSize[i]]+rodSizeCost[i], costMatrix[i-1][j]); } } intmain() { for(int i=0; i<ROD_CUTS; ++i) { for(int j=1; j<=LEN; ++j) { costMatrix[i][j] = findCost(i, j); } } cout << "Maximum Profit = " << costMa…

Implementing Stack using Linked List

QUESTION-
You need to implement a Stack class using linked list. The data members should be private. Implement the following public functions :1. Constructor -Initialises the data member (i.e. head to null).2. push :This function should take one argument of type int and has return type void. This function should insert an element in the stack. Time complexity should be O(1).3. pop :This function takes no input arguments and has return type int. This should removes the last element which is entered and return that element as an answer. Return 0 if stack is empty.Time complexity should be O(1).4. top :This function takes no input arguments and has return type int. This should return the last element which is entered and return that element as an answer. Return 0 if stack is empty.Time complexity should be O(1).5. size :Return the size of stack i.e. count of elements which are present ins stack right now. Time complexity should be O(1).6. isEmpty :Checks if the stack is empty or not. Retu…

find largest binary search tree in a Binary Tree

We have to write a program to find the largest binary search tree (BST) in a given binary tree.
A given tree is BST if the value of node is greater than the value of its left child and smaller than the value of its right child.
We will use top-down approach for solving this. We will traverse the whole tree. At every node we will check if the subtree is BST or not. If the current tree is BST then we found the largest BST. If not, then we  have to check the whether left or right subtree is BST or not. If only one tree is BST then we will return that subtree. If both left and right subtrees are BST, then we will return the larger of the two.
Example:                                              60                                          /         \                                      50           90                                   /      \        /      \                                40     55    70     100                                                 /         /     \         …