Skip to main content

Posts

Transfer google play balance to Paytm, PhonePe, Google Pay or any UPI linked bank account.

To transfer google play balance, opinion rewards or gift cards to PayPal, Paytm, PhonePe, Google Pay or any UPI ID linked bank account , you can use QxCredit :Rewards Convertor app which is available on google play store: You will get back 80% of the google play balance. App link:  https://play.google.com/store/apps/details?id=qxcoding.qx_credit_reboot Follow these steps to transfer your play balance to paypal or UPI: 1) download app from play store. 2) login with your google account and phone number. 3) choose a token amount which you want to convert/transfer. 4) Enter your payout details.(UPI ID or PayPal Email) 5) wait for an acknowledgement mail form qxcredit containing information about your purchased token. 6) you will receive the amount within 3 days. 7) if you face any issues you can raise a query on website: https://qx-credit.web.app/#/contact_support About app: Introducing QxCredit : Rewards Converter Convert /Transfer or Exchange your Google Play Balance and opini...

How to merge two sorted singly linked list

here we will discuss ,how to merge two sorted linked list such that the final list is sorted in ascending order the structure ( node ) definition is given below: typedef struct node{ int val; struct node* next; }* node; Explanation: we will insert (merge ) the elements of list 2 (f2) in f1 by comparing each nodes value. ALGORITHM: traverse both lists till one of them is completely traversed compare the values of node and if the value of node of list f1 is smaller then move to next node of f1 and increment the value of pos. the pos variable will be used after complete traversal to join the remaining elements of f2 if any. and if f2 nodes value is smaller then insert it before the current node in f1 and set f1 to previous node that is the node of f2 and increment f2 to next node. after completely traversing one of the lists , append the remaining elements of f2 if any in f1 . void merge_ll(node *first){ delete_ll(*first);*first=NULL; int pos=0; printf(...

How to Reverse a Singly linked list ? C/C++ Program

To reverse a given linked list ,we have to point the next (link) of each node to its previous node(ie: the node which is pointing to it.) for that we will maintain three pointers : 1) prev : will point to the node which is pointing to the current node. 2) cur : will point to the node in which we have to change the next(link) to the previous node. 3) next: in the process of changing the cur->next to prev the           cur->next will be lost so to store the address of cur->next we use next pointer. Node definition: typedef struct node{ int val; struct node* next; }* node; as given above the node contains two members value and a pointer pointing to its own datatype which will store the address of another node . reverse_ll(node *first) : function : void reverse_ll(node* first){ node prev=NULL; node cur=(*first); node next=NULL; while(cur){ next=cur->next; cur->next=prev; pr...

How to find the occurrence's of a pattern in a given string Using KMP algorithm?

For finding the pattern in a given string , we are going to use KMP algorithm for individual occurrence of the pattern and print the reference index of the original string. The function which will find the pattern in a given string : int KMP(char * str,char* find,int s){ int sl=strlen(str); int fl=strlen(find); for(int i=s;i<sl-fl+1;i++){ int i1=i; for(int j=0;j<fl;j++,i1++){ //cout<<j<<fl<<endl; if(j==fl-1)return i; if(str[i]!=find[j])break; } } return -1; } For finding all the places (positions/index) where the pattern is present, we have to call the above function repetitively with passing the index from where it has to resume the search as a parameter to the function. The same is implemented in the function below: int print_occurence(char* str,char* find){ int sl=strlen(str); int fl=strlen(find); int occ=0; for(int i=0;i<sl;i++){ ...

How to find the height of binary tree ? program (Python)

The height of binary tree is defined as MAX(depth of leaf nodes)  and depth of a node in turn is defined as (n-1) ,where n = the least number of nodes traversed through, to reach that node. For detailed information on Implementing binary tree in python : refer here. Definition of height function: def height(self): if self.root == None: return 0 else: return self._height(self.root, 0) def _height(self, cur_node, cur_height): if cur_node == None: return cur_height left_height = self._height(cur_node.left_child, cur_height + 1) right_height = self._height(cur_node.right_child, cur_height + 1) return max(left_height, right_height) Here, two functions are used one is used to check that if the binary tree exists or not , if exists then it will call the recursive function to traverse the left branch and right branch depth with respect to the root node , and then returns the bigger of the two by comparing. The value of depth(height ) of...

How to create a Binary Tree Program ( Python / C / C++ )

What is a binary tree? A binary tree is categorized as an abstract data type , whose (I/O) ,(R/W) operations are handled by the user defined functions.A binary tree is a special case of a tree DS where each node except leaf nodes has two children's . for creating a binary tree we will define a class / structure node which will contain the members(left child and right child) and the value. class node: def __init__(self, value=None): self.value = value self.left_child = None self.right_child = None Now , we will write the code for inserting elements in our binary tree, we will create the function in another class containing a member which will store the address of root node and add all successive elements under the root node . def insert(self, value): if self.root == None: self.root = node(value) else: self._insert(value, self.root) def _insert(self, value, cur_node): if value ...

How to find and replace a node in Linked List

For replacing an element in a linked list first we have to find it , for that we will use a function which will do the finding part and give us the node's address (pointer) and then we will replace the value of that node by the value given by the user. Definition of node* find_pos(int) function node* find_pos(int val,int p){ node* cur=first; node* prev=cur; while(cur->val!=val){ prev=cur; cur=cur->next; if(cur==NULL)return NULL; } switch(p){ case 0: return cur; case 1: return cur->next; default:return prev; } } The above function keeps track of the previous node and keep traversing through the linked list until we find the value which is to be replaced, it return the previous node if value of p is -1 or returns current node if p=0 or next one if p=1. Definition of find_replace function void find_replace(int find,int replace){ int c=0; while(node *temp=find_pos(find,0)...

How to Insert ,Delete ( first or last ) nodes in Linked List C / C++

Node definition (Structure) : struct node{ int num; node* next; }; The num variable stores the data given by the user and the pointer (next) stores the address of the next element present in the linked list. Insertion of Nodes : 1) Inserting in beginning :  void insert_beg(int value){ node* n=new node; n->num=value; if(first==NULL){ n->next=NULL; first=n; } else{ n->next=first; first=n; } } the above function ,when called creates a new node and stores the value passed to it in num (variable) ,now the function checks if the list is empty and if it is empty then it is simply marked as the first element in the linked list. if the list is not empty then the pointer (next ) is assgned to the first element address and the marker (first) is given to current element. 2) Insertion at end :  void insert_end(int value){ node* n=new node; n->num=value; n-...