Category "data-structures"

BubbleDown function(min heap) not working

I have generated a minheap to this file but I think something I have missed but I can't identify what are the things I have missed. I have missed something on

How to get list of palindrome in text? [closed]

I have the following interview question that may require traversing through the entire string. Problem I searched about find Problem and most

how to alter reduce function so it produce different result

I have this array: data: [ '+section1+', 'big text 1 here.', 'big text 2 here followed by list:', '-this is list item;', '-this is another list item;'

Transform array into object with custom properties

I have this array myarr = [ '=title1', 'longText0...', 'longtText1...', '=title2', 'longTextA...', 'longtTextB...', 'longtTextC...' ]; symbo

Directed SPT vs SPT?

Question: If a graph contains no negative-weight cycles, does there exist an ordering of edges such that Bellman-Ford computes shortest paths by relaxing each e

How to insert records into a Nested HashMap?

I want to create a nested HashMap of: var myHashMap = new HashMap<String, HashMap<String, int>>(); And I want to insert records into the inner Hash

Circular linked list not working after appending 3rd node

It's Showing output for 2 nodes but after adding 3rd node it doesn't showing any output, what i'm doing anything wrong?? This is the append method that i have

Is there a way to make a node of Linkedlist point to a node that isnt next in the list

I am making a snakes and ladders game in C using a LinkedList, I have a square struct that represents squares on the board. I need to add snakes and ladder that

insert zk log check in and out to one row in database

I am retrieving data from ZK attendance device using zkteco-sdk-php. The out come is like this UID ID NAME STATE DATE TIME TYPE 55 275 Employ1 Fingerprint 19-0

Python modulo returning wrong answer

I was attempting this question on leetcode using python3. My solution for this problem is as follows: class Solution: def __init__(self): self.memo

Tokenize a std::string to a struct

Let's say I have the following string that I want to tokenize as per the delimiter '>': std::string veg = "orange>kiwi>apple>potato"; I want every

Find the maximum number of distinct elements that can be achieved in array a after at most k operations

My assignment: Consider two arrays a and b where each consists of n integers. In one operation: Select two indices i and j (0 <= i,j < n) Swap integers a

Island perimeter problem - cannot count all neighbor cells

I'm working on the Island Perimeter Problem from LeetCode. I tried to use the DFS algorithm, based on LeetCode#200, to solve this problem. For example 1, the ou

How to write this piece of code more briefly

I am trying to implement a graph using HashMap where I store the nodes (vertices) on the key column and the adjacent nodes ( adjacent list ) as a HashSet on the

Is it right to implement queue with single linked list?

My Code ↓ Some macros defined by #include <stdio.h> #include <malloc.h> #define ElementType int #define ERROR 0 // 队列ஷ

Is there a way to initialize or modify a list that allows to reference previous values?

I want to store non-rectangular data in a structure, e.g. in a list. Referencing previous data works using a tibble, e.g. like this: dat <- tibble(a = 2,

How can I organize Role Based Access Control (?) in my scenario?

I have a database where there are products grouped by categories. When a user registers, he selects a category, which cannot be changed. The user will be able t

Java - Predicate to find Node with set value

I came upon object graphs while studying. And while they seem "cool" and useful, a related problem to the material made absolutely no sense to me. public class

How do i create a function to convert a binary tree to a tuple?

i came across this question where i was tasked to convert a tuple into binary tree and then convert binary tree back to tuple and return both tree and tuple. i

Describing a numbering system that counts from x at the y position in an index

From a theoretical perspective, I'm interested in learning how one would correctly describe a numbering system that starts counting from x at the y position in