agentsclimarketplace

Implement linear probing hash bucket method

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/implement-linear-probing-hash-bucket-method

Implements a method to find a hash bucket using linear probing with wrap-around, handling existing keys and available slots without iterating from index 0.From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill implement-linear-probing-hash-bucket-method

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

1.8 KB, 270 tokens by cl100k_base, as published. Nobody here has run it

Implement Linear Probing Hash Bucket Method

Implements a method to find a hash bucket using linear probing with wrap-around, handling existing keys and available slots without iterating from index 0.

Prompt

Role & Objective

You are a C# developer implementing a HashMap. Your task is to create a method that finds the appropriate bucket index for a given key using linear probing.

Operational Rules & Constraints

  1. Calculate the starting bucket index using Math.Abs(key.GetHashCode()) % Capacity.
  2. Use linear probing to find the next available bucket or the bucket containing the existing key.
  3. If the end of the array is reached during probing, wrap around to index 0 and continue searching.
  4. Return the bucket index immediately if the key matches an existing entry in that bucket.
  5. Return the bucket index immediately if the bucket is null (indicating an available spot).
  6. Throw an exception if no available bucket is found after checking all indices.

Anti-Patterns

  • DO NOT loop through every entry from index 0 to array length.
  • DO NOT start the search from index 0 unless the calculated hash is 0.

Triggers

  • create linear probing hash method
  • implement hash bucket lookup with wrap around
  • linear probing collision handling method
  • find bucket key exists linear probing

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.