data structures – Enhance B-Tree with find(k) function

I have a question to enhance a B-Tree and add a function called find(k) which gets a key – k and returns the index of it in the sorted keys of the tree, using $O(N)$ space complexity, and it needs to be in $O(t cdot log_t{n})$ time complexity. I also need to show that the function does not make the regular functions (insert, delete, split child) any different then what they used to be before ( time complexity- wise)

for example, for this tree (Only example! max degree = 3, t=2 because $MaxDeg = 2 cdot t – 1$):

enter image description here

find(50) would return: 6 (because its in the sixth element of the sorted keys: 10 10 20 20 20 50 60 70 80)

I thought about storing how many keys are before each key, and thus we can actually do it in $O(1)$ but it seems unrealistic, if the question asks for $O(t cdot log_t{n})$

Thank you!

data structures – why segmentation fault is arising , because of these three lines?

The code is giving segmentation fault. But it is working fine, :

  1. if i remove the first weird line “q++;”. Or
  2. if i call solve(s,1) in main function instead of solve(s,0) at third weird line.
  3. the code is working fine if i use “solve(s,q)” at second weird line.
'''
#include
using namespace std;

>bool solve(string s,int q)
{
    q++; //first weird line
    if(q==10)
        return true;
    solve(s,q+1);//second weird line
    return false;
}

int main()
{
    string s;
    cin>>s;
    solve(s,0);//third weird line

    return 0;
}'''



data structures – Algorithm for splitting an array into k sub-arrays

We want implement a data structure that have the following methods: Init(A,k)- Gets an array A with n different values and initialize our data structure that so it will divide A into k equally sized sub-arrays (+-1), that each value in the i’th sub-array will be larger than any value in the (i-1)’th sub-array, and smaller than any value in the (i+1)’th sub-array. This method need to be applied in complexity of O(n log k).

Insert(x)- Gets a value x which isn’t in our data structure, and adds it. This method need to be applied in complexity of O(k logn).

I did the init method using Medians- ofMedians QuickSelect, by dividing the array into k’ sub arrays when k’ equals to the closest power of 2 for k, and then I adjusted my pointers to the dividers by using Select on the smaller arrays which added me only O(n).

With the Insert part I’m having some trouble and would appreciate any help, Thanks:)

I have seen crack like structures near the edges of of the front part of my lens. Are these cracks and should I be worried about it?

As you can see in the image I have seen some structures that look like cracks on the edges of the front part of the lens with violet bluish color around them.enter image description here These seems to be inside the front glass. There are 4-5 of them. I could show two of them. Though they do not seem to affect the pictures taken with it.

data structures – Algorithm for Calculation of a String

I am making an android application for a basic calculator(which can perform +,-,/, and *) but same as a modern Smartphone’s calculator app does.
For Example: If you type 2 than 2 should be automatically printed on Output box. and if you move further and type + after that than whole expression will be 2+ and this should still output 2 on the output box. If you move further again and type 3 than whole expression will be 2+3 and output box should show 5 . Again if you add 7 than expression will become 2+37 and this time output should show value 39 . Again if you move further and type * than expression will be 2+37* this should still output 39 on output box. If you further add something lets say 3 than expression will become 2+37*3 and this should output 113.

I want to perform calculation every time any button is pressed so that I could show Output automatically like a real smartphone calculator does.So I want to make a function which takes String as output and returns a Double value.

Double calculate(String S) 
{ 
   Double res=0.0d;
   ... 
   ...
   ...
   return res;
}

I tried many things but not getting success.Please help me with this. If you need to ask or make anything clear plz ask.

Data structures – How high is the spatial complexity of a Python dictionary?

If Python dictionaries are essentially hash tables and the length of the hashes used in the Python dictionary implementation is 32 bits, this means that regardless of the number of key-value pairs that actually exist in a particular dictionary, that Dictionary size is static and fixed with a length of 232.

Such an implementation would be a waste of memory, so I assume that this is not the actual complexity of the space. How is a Python dictionary actually implemented and what is its spatial complexity?

C ++ – the best way to learn data structures as a self-learner?

After getting stuck writing my own allocator learning C ++, I decided that it would be a good idea to learn some basics about data structures and algorithms.

The problem is that most of the sources I come across focus on asymptotic notation, best / worst / average cases, mathematical induction, and explain what a variable is, how it relates to user data types and what system data types are, what is algorithmic Correctness and other academic matters that I couldn't care less if I really need to implement them begin() and end() for this tree-based container.

Are there books or other learning resources that explain the implementation of common data structures and algorithms in a digestible and practical way?

ag.algebraic geometry – $ mathcal {M} _g $ and $ mathcal {A} _g $ have natural structures as quasi-projective varieties

When I read M. Hindry and J.H. Silverman (Diophantine Geometry-An Introduction), I find the claim that $ mathcal {M} _g $ and $ mathcal {A} _g $ have natural structures as quasi-projective varieties. The book by Mumford and Fogarty (Geometric Invariant Theory) serves as a reference for this statement. However, it is an advanced book for me. I cannot determine where this is proven in the book by Mumford and Fogarty. Can someone help me find ???

dnd 5e – Can silk stop the angry orc? or do fragile structures offer less coverage?

The rules do not define coverage at all.

In fact, the rules hardly define anything. But we can work out a definition if you want.

The cover rules generally tell you what cover is and how you can represent it in game mechanics. "Walls, trees, creatures" are examples to illustrate what we are talking about. The overall category of "… other Obstacles "implies that all of these are Obstacles. An obstacle is something that hinders, blocks a path and stands in the way.

The other important words here are "in battle" and "it's harder to harm a creature". That tells us something property The obstacles allow them to act as cover (making a creature more difficult to hurt) and that context where this trait should be considered ("fight," so the damage we're dealing with is slapped in the face or shot with arrows or the like).

Taken together is coverage An obstacle that makes it difficult for a creature to deal damage in combat.

So if you hang a silk curtain between yourself and the ax-wielding orc berserker, will it be harder for you to do damage? Probably not, so it's not covered in this situation.

On the other hand, a silk curtain or even a sturdy net could keep them away if what is trying to harm you is a swarm of excitement.