Questions tagged [algorithm]
The algorithm tag has no usage guidance.
16 questions
0
votes
1
answer
76
views
How to merge objects in query?
I have 2 custom objects. Let's say its customObj1__c and customObj2__c.
List<customObj1__c> obj1 = [SELECT Id, Name__c, Age__c FROM customObj1__c ORDER BY CreatedDate ASC];
List<customObj2__c&...
0
votes
0
answers
27
views
Is there any way to perform my required logic other than with recursion applied on a tree data structure?
This is the most complex logic I've ever worked with in Salesforce.
I'll try to describe my requirement in simple terms.
I have a custom object which has a date field(StartDate__c), and a number ID ...
0
votes
1
answer
73
views
Algorithm to calculate Risk Rewards ratio in trading?
Currently, I am developing a trading calculator where I need to calculate the ratio between Risk and Rewards (Risk:Rewards). But I am getting the ratio value in decimal (0.21) as I am directly ...
0
votes
1
answer
196
views
In the 18-character ID algorithm implementation, why did they reverse the 5-character chunks?
While reading further about Salesforce Ids, I came across this article detailing how three extra characters are appended to the original 15-character record Id in order to identify the casing of each ...
1
vote
1
answer
416
views
How to convert a JSON string stored in a Content Document back to a Map and merge it with a Map of similar type? [duplicate]
I have a Map of type -
Map<String, List<List<LineInfo>>> valuesMapOne = new Map<String, List<List<LineInfo>>>();
This Map is serialized and saved into a ...
0
votes
2
answers
359
views
Better way of searching for values in apex list
I have a list of unique strings say 'one' to 'ten' as below:
List<String> values = {'one', 'two', 'three','four','five','six','seven','eight','nine','ten'};
I have a requirement to check if the ...
0
votes
1
answer
50
views
is it possible to write an algorithm in zbase32? [closed]
I have a request to generate unique codes through an algorithm.
take a unique number from a sequence (maximum value 2 ^ 30)
ZBase32 encoding is used to encrypt the number.
The encoding alphabet is as ...
0
votes
3
answers
811
views
Balanced brackets
I need to implement a function that determines whether brackets are balanced. Here are a couple of examples of how it should work:
'' => true
'[]' => true
'{}' => true
'() => true
'[[]'...
2
votes
4
answers
2k
views
Recursive Algorthims In Apex
This is really just a general CS question. I have been trying to increase my knowledge of algorithms and data structures. And of course, every CS class is full of examples of recursive algorithms. ...
-1
votes
1
answer
111
views
Apex-optimized algorithm for "road atlas city distance matrix" style utility data? [closed]
I'd like to automate a business process that currently involves a road-atlas-style "distance chart" as seen here.
When an employee is hand-reviewing records for deduplication, if a given "status" ...
-1
votes
1
answer
43
views
Creating fulsome combinations of list elements
I have been having some issues getting the logic down for the following:
Simplifying, I have an N-element list of Skids defined as:
public class Skid {
public Integer length { get; set; }
...
0
votes
1
answer
41
views
Can I do this part of code shorter and cleaner? How?
Help me please: I want to make this part of code shorter. Maybe with a few methods. But I don't know how to do that with using SOQL. To many double-parts are here.
public List<Item__c> ...
2
votes
1
answer
1k
views
Split a List to create a separate list while satisfying 2 conditions.
I have a list (List A in image) of Cases. Each case record has a field 'External Id'. I have to create a separate List such that, for all cases which has the same F-ID's, it should take the case ...
2
votes
1
answer
399
views
Sketch of heap usage prior to algorithm implementation
I'm trying to have an idea of what would be the heap usage of a certain algorithm in Salesforce, given different inputs in order to determine if I should implement it async or sync.
I am aware that ...
0
votes
1
answer
1k
views
encrypted password to plain text password Using 3DES algorithm [closed]
How to convert encrypted passwod to plain text password?
please any one give some idea for this.
I have a AES256 algorithm as given below. I need 3DES algorithm .
Blob cryptoKey = Crypto....
2
votes
1
answer
237
views
Does Crypto class support SHA384?
We are calling a service from salesforce. This service is expecting a specific hash in the httpHeaders collection of the HTTP Request.
The service is written in .NET and the hash is computed using ...